Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.

learn more… | top users | synonyms

0
votes
0answers
8 views

What tests does the anova() function for model slection use to derive the p-value

I am performing model selection using the anova() function in R. Model 1 is a 'baseline' model involving an interaction of the experimental manipulandum as the predictors. Each subsequent model ...
0
votes
0answers
12 views

Confidence interval of first derivative of a loess smooth

I have plotted with ggplot{ggplot2} the evolution of parameter vs time. I would however prefer to plot the change in these parameter vs time. Here, I have seen how to get the first derivative of a ...
0
votes
0answers
14 views

The Causal Impact Package in R could not trace the right number in the test group

I have this sample dataset which is as follow: head(data) ...
0
votes
0answers
9 views

What is the junction tree of the following graph?

I got so confused in the remaining steps (from triangulated graph to junction tree) after turning my Bayesian network to a triangulated graph. Would anyone please help?
0
votes
0answers
12 views

bayesian classification unknown domain

Suppose I am building a naive Bayes model to classify text messages as either spam or legit. I am training my model using a dataset containing both classes and for which I know the domain (the number ...
0
votes
0answers
28 views

Robust M-estimator of location and dispersion by hand in R

I try to estimate a location and dispersion model with R, as described Maronna et al (2006, pp. 56). However, my estimate dispersion does not converge to the desired value. Do I have an error in the ...
0
votes
0answers
7 views

Step by step guide for GRS test in R?

I'm new to R. I have basic knowledge in R. I'm testing a factor model. I have to use GRS test. But not sure how to do it. Please help me. I have found this recipe for GRS online. http://faculty....
2
votes
0answers
28 views

Simulation of random-effects meta-analysis yields biased tau^2

I need to realistically simulate study effect sizes and within-study variances for a random-effects meta-analysis in which the outcome is a relative risk. My question: why does this simulation lead to ...
1
vote
0answers
8 views

Covariance matrix of the initial state vector. KFAS package

Any given ARIMA(p,d,q) model $y^*_t=\sum_{i=1}^pa_iy^*_{t-i}+e_t+\sum_{i=1}^qb_ie_{t-i}$,where $ y^*_t=\Delta_dy_t$ - the difference of d$^{th}$ order, can be re-written as a dynamic linear model in ...
0
votes
1answer
26 views

How to select the optimal number principal components in functional principal components analysis?

I am interested in the selecting the optimal number of principal components in functional principal component analysis (FPCA). There are various techniques to do that for example AIC, BIC etc. (I am ...
0
votes
0answers
26 views

Quantitatively analyzing relationships between multinomial and multiple binomial variables

I’m analyzing crowdsourced Twitter data, where workers labeled tweets. Within my dataset (N=2,400), I have one IV (call it ‘ds’) with 2 levels that differentiates which dataset the workers labeled. I ...
0
votes
0answers
12 views

flexible discriminant analysis computational completixy

I'm using mda package + caret infrastucture to perform a flexible discriminant analysis for a classification problems. I have 26 features of mixed type. I found little if any guidance on the ...
1
vote
0answers
32 views

Implicit estimator, it's variance and expectaion

Denote with $V_j$ the firm's value of $j$-th firm. We will speak of default, if the firm's value falls below predefined barrier $c \in \mathbb{R}$. The random variable $L_j$ will indicate, if $j$-th ...
0
votes
2answers
33 views
0
votes
0answers
10 views

Alternate of table function of Base Package in lieu of Graph Plotting like below

Please check the image link.For plotting this I generally use Table function in Base package which automatically takes care of count and I use in geom_point aesthetics (size=freq). Is there any ...
2
votes
1answer
17 views

Nested random factor with confounding (random?) variable

I have a question on how to specify a GLMM. I made an experiment with two treatments (control and treated) to test the effect of a water contaminant on reproductive cells of tadpoles. I have data on ...
1
vote
1answer
13 views

Cumulative link model with categorical or continuous predictors?

I have data in a perception experiment where I show surfaces slanted at different angles and ask participants to judge whether the surface could be stood on. I also asked them how certain they are ...
0
votes
0answers
4 views

How can one create a time series object with multiple time series? [migrated]

How can I convert "A. Raw data" into "B. Time Series Objects" in R so I can perform time series analysis on multiple time series at a time? Please see to sample outputs below. A. Raw data month ...
0
votes
0answers
7 views

How does gbm (in r) control the sub-sampling of predictor variables? [on hold]

In gbm, the parameter, bag fraction, is used to randomly select subset of observations. And the sampling could be contorlled by set.seed() before gbm (Please correct me if I was wrong). But is there ...
1
vote
0answers
31 views

Orthogonal polynomial expansion and QR decomposition

Here is the source code of R poly function (boundary checking are removed). Why we can use QR to build polynomial expansion, ...
0
votes
0answers
7 views

Ordering by importance when plotting partial functions from forestFloor

I would like to start by saying that I am relatively new to the R packages randomForest and forestFloor and I have never posted a question on here - so please be temperate. I have been working on an ...
1
vote
0answers
35 views

adonis in vegan: limiting permutations when design isn't fully blocked

I have read over the help files and examples online on using adonis with blocked designs but haven't really found a solution to my particular case. I'm fairly new to permutation-based methods so ...
-2
votes
0answers
18 views

Error in if (!n.cat[i]) { : argument is of length zero [on hold]

I am just beginning to learn to code using R. I tried to do a classification by C5.0, and I encounter a few problems. I am looking for help with gratitude. Below is the code I learned from someone ...
2
votes
0answers
31 views

Why Neural Network is Failing in a simple classification case [on hold]

I have the code below where a simple rule based classification data set is formed: ...
1
vote
1answer
22 views

Why does the Arima() method in the forecast package in R not calculate standard errors for coefficients passed to 'fixed'?

In the Arima() method, in the forecast package in R, I can provide a vector of parameters to the ...
-1
votes
0answers
18 views

Global Minima and Local Maxima in Random Forest Classifiers in R [on hold]

I am learning Random Forest Classifiers and I want to know how can we determine the Global Minina, Local Minima, Local Maxima of a Random Forest classifier. Can some one help with this?
1
vote
0answers
39 views

Reversing SVD back to the original variables [on hold]

I have a large collection of text documents I am trying to group using Singular Value Decomposition for dimension reduction(popularly known as LSA) followed by k-means clustering. Subsequently, I ...
0
votes
0answers
10 views

Moderation analysis for repeated measures ANOVA [on hold]

My dataset looks like this: My hypothesis is that the statistical differences between the within-subjects measures (A1 vs A2 vs A3) are moderated by a third variable (mod) which is continuous. What ...
0
votes
0answers
26 views

Hand computation for plm package in R (twoways model) for predicted values [on hold]

I have one question on the plm package. I try to compute predicted value in the case of a twoways (effect = "twoways") model. ...
0
votes
1answer
9 views

fGarch and include.shape in R

I just started using the "fGarch" package in R and until now everything has been going fine. I have estimated two successful models from two different datasets that have been estimated correctly ...
0
votes
1answer
47 views

Using lme to perform a nested ANCOVA in r

I want to perform a nested ANCOVA using the function lme in r. My data concerns the growth rate (sgr) of fish at different temperatures (temp). In the trial there were 3 replicate tanks each housing 8 ...
1
vote
0answers
14 views

GAM set a smoothing degree

What is the difference between the EDF (effective degree of freedom) and the degree of smoothing in a General Additive Model (GAM)? For example: ...
0
votes
1answer
39 views

Interpreting R regression output with multiple interaction variables

Context I am exploring how different factors in targeting affect subjects' self-reported likeliness to purchase a product. Likeliness to purchase was measured on a four point scale: "Very unlikely", "...
-1
votes
0answers
14 views

Accurate descriptives from a plot [on hold]

With the help of a good friend like you, I'm using the following code: P <- choose(N-100, 50) / choose(N, 60) and the plot it like this: plot(N, P, type = "l") # The plot looks like this: ...
-2
votes
2answers
51 views

plotting a factorial function in R

I have problem trying to plot the following function in R: The R code I'm using is: ...
0
votes
0answers
22 views

Help running a Difference in Difference

I have a simple linear DiD model for patent count data $$ patent_{ut}=\beta_0 +\beta_1 grant_u +\beta_2ptreatment_t +\beta_3 interaction_{ut}+error_{ut} $$ where u denotes a university and t denotes ...
0
votes
0answers
15 views

compare the similarity of two cluster results using igraph

i am comparing the results of two clusters using igraph, such as What is the intuition behind the variation of information (VI) metric for cluster validation? I see there were consistency for all ...
1
vote
0answers
14 views

got msg “convergence warning in initialization\n” running svmpath() [on hold]

I got msg "convergence warning in initialization\n" running svmpath(). Data consist of 15 factors, transformed by "model.matrix" into 84 constrasts; 4452 instances. ...
0
votes
0answers
21 views

Summation constraint matrix

I'm trying to create an assignment script using the R package Rsymphony, but I can't seem to figure out how to convert the summations into an actual constraint matrix. I tried to figure it out based ...
0
votes
0answers
3 views

Trying to complete monte carlo simulations with spatial data

I will try to make this question as simple as possible, but in reality, it has multiple sections and objectives. To begin, I have observational temperature data over a metro area, every hour for 3-4 ...
0
votes
0answers
7 views

What is the difference between these mixed ANOVA specifications

I am trying to perform a mixed ANOVA analysis with one between subject and two within subject factors. Some Experiment information Two groups of 17 subjects (old and young participant group) Three ...
0
votes
0answers
17 views

Purposeful model building for prediction and inference

What are some of the best practices and steps to building models for prediction and or inferences? What have been taught to me during my classes was the steps outlined in Chapter 4 of Hosmer et al. ...
1
vote
0answers
31 views

Importance interpretation with randomForest using R

I'm working on a predictive model using randomForest. I have some interesting results but the important variables got me confused. While using the varImPlot from ...
0
votes
1answer
27 views

I do not understand the chisq.test output

I have three variables: str(vw) num[1:2500] 56 74 98 23 ... str(autos) num[1:2500] 29 34 57 21 ... str(ask) num[1:2500] 41 118 70 79 ... The summary functions ...
0
votes
0answers
17 views

Alternatives to McNemar-Bowker test when symmetrical cells have zero count in contingency matrix

I need to test the difference between pre- and post- intervention over a 4-grades parameter computed on 57 samples. The contingency matrix on which I need to compute a McNemar test for paired data (...
2
votes
1answer
30 views

Endogenous ordered probit (Stata, R)

main equation $y_1 = y_2 \beta + x_1 \gamma + u_i $ Instrumental equation $y_2=x_1 \pi_1 + x_2 \pi_2$ I have a binary endogenous variable $y_2$ in my main estimation equation. My instrument $x_2$...
-1
votes
0answers
20 views

Not a valid installed package error in R - biOps [on hold]

I m trying to install package biOps in R. i downloaded biOps_0.2.2.tar.gz from cran but it is showing error. install.packages("C:/Program Files/R/R-3.3.1/bin/biOps_0.2.2.tar.gz", repos = NULL, ...
0
votes
1answer
49 views

Estimating risk in linear regression analysis

I am relative new in regression analysis. I would like to know, if there is a way in regression analyis to estimate the risk or calculate the risk for future values? An example: We want to predict ...
1
vote
0answers
26 views

Most reliable method to compute 95% confidence intervals of proportions for small samples

I am planning a prospective trial for CE mark of a new cardiovascular device, and wish to use 95% confidence intervals to present, once data are collected, the inferential estimate for the occurrence ...
0
votes
1answer
19 views

Regarding probabilites for naiveBayes algo

I have trained my data with naiveBayes algo in e1071 package. I have 6 classes in my data. I have predicted test data. the prediction returns only one class for each data point but I would like to ...