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

1
vote
0answers
30 views

Interpretation of various output of “lmer” function in R

library(lme4) fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) The notation (Days | Subject) says to allow the ...
0
votes
1answer
54 views

Finding pattern from sparse matrix

I have a large sparse matrix which represents whether the action is happened or not. Each columns represent each action. Each row represents time. The data is collected for every 15min. Zero in the ...
0
votes
0answers
27 views

Naming convention for column names

I have a general question. Is there any rule or convention about how to name columns in general (CSV, R, relational databases and so on)?. If I need to be more specific, I would like to know for R. I ...
0
votes
1answer
28 views

Help evaluating a model in R

I am a newbie in R and I am trying to do my best to create my first model. I am working in a 2- classes random forest project and so far I have programmed the model as follows: ...
0
votes
1answer
31 views

Can anyone help me with R code for the two-step generalized method of moments (GMM) [on hold]

I am new to R and need to do a 2 step Generalized Method of Moments estimation. Can anyone help me with an example code. Thanking you.
0
votes
1answer
35 views

Creating a test set with imbalanced data

I am working on a binary random forest using R. mu data set consists of 300 cases classes 1 and 2100 cases class 0. I am planning to evaluate my model using the model prediction and the AUC and for ...
1
vote
1answer
34 views

Generate independent random values from a bivariate normal distribution

I am trying to independently select two sets of numbers (set 1 and set 2) from a bivariate normal distribution. I want the ...
0
votes
0answers
24 views

Using update() with lmer() for fixed effects only [on hold]

I think this may be a very simple yes/no answer, but I can't find anything in the docs. I'm doing a series of linear mixed model comparisons with lme4. For each comparisons, I'm adding a single new ...
0
votes
0answers
8 views

Using R to calculate between- by within-subj ANOVA interaction contrasts using car or lme [migrated]

Psychology student here. As part of my thesis I have some data from an experiment with two between-subjects IVs, classification and ...
0
votes
0answers
8 views

Splitting DocumentTermMatrix in R [migrated]

I'm looking to create a word pair prediction function, but am having trouble working with DocumentTermMatrix to data frame or similar to use in prediction function. Here is my working code: ...
-1
votes
0answers
18 views

How does the cross validation function in R work when the sample size is non divisible? [on hold]

How does the cross validation function in R work when the sample size is non divisible by the number of folds?
-1
votes
1answer
24 views

Cross validation when only the regression equation is given [on hold]

Is there any function in R to conduct cross validation when you only know the regression equation?
1
vote
0answers
36 views

Inconstant logistic regression coefficients each time algorithm is run [SOLVED] [on hold]

I'm running a logistic regression to find a relationship between falls and drugs taken by someone. What happens is that every time I re-run the algorithm it gives a different result. The table is ...
1
vote
0answers
17 views

Interpreting silhouette coefficeint for clara function in R

I am trying to do clustering on a distance matrix which contains numeric data. But I am not sure how to decide upon the number of clusters or value k for clara function in R. But after running it with ...
4
votes
2answers
123 views

Comparing a linear model with a spline model

I try to figure out how to describe my continuous variable. Unfortunately, I did not understand all of the statistics. I would really appreciate I you guys would help me out here. To better illustrate ...
0
votes
0answers
37 views

Using BIC,AIC for estimating number of clusters in document clustering using Kmeans

In my approach I am trying to find the optimal value of 'k' for clustering a set of documents using KMEANS algorithm. I wanted to use 'AIC' and 'BIC' information criterion function for finding the ...
-1
votes
0answers
21 views

Maximum important variable using PCA [on hold]

In the following figure of biplot for PCA, can I say that petal.length and petal.width are most important variable in iris dataset because they are explaining most of the variance of the whole ...
0
votes
0answers
21 views

Type one right censored data [duplicate]

Does anyone have any idea about how to simulate censored data in R? For example, generate a sample of 200 with 30% of that Type 1 right censored, based on Weibull distribution. (30% of 200 = 60).
1
vote
0answers
7 views

Backing out fixed / random effects in lmer mixed model

Assume that I have a linear mixed model of the following form, specified using lme4: fit <- lmer(A ~ B + C + (1|D) + (1|E), data=data) I am struggling with ...
1
vote
1answer
31 views

Proper way to cite R help?

I want to cite the R help description of a function. Is there a proper way to cite the R help? Or should I simply cite the package of the function?
0
votes
0answers
11 views

Correlated errors within group with nonvarying dependent variable

I am trying to run a model in R to show how well one survey (SurveyA) predicts responses to another survey (SurveyB). SurveyA has 20 questions and we get an estimate of the participant's parameter ...
-1
votes
0answers
9 views

how to give classes to hclust output at specific height [on hold]

Am new to R , Using rect.hclust(fit2, h=10079,border="green") draws green rectangles around the matched points, how can I assign classes to these points and print ...
2
votes
2answers
59 views

Assigning Weights to An Averaged Forecast

So I've been learning how to forecast over this summer and I've been using Rob Hyndman's book Forecasting: principles and practice. I've been using R, but my questions aren't about code. For the ...
1
vote
0answers
15 views

How to compute Voronoi tesselation based on manhattan distance in R [on hold]

I am trying to compute a Voronoi tesselation in 2D with the Manhattan distance in R. Ideally this would be a function that takes a set of two-dimensional points ...
1
vote
1answer
25 views

Interpreting a longitudinal generalized estimating equations beta cofficients

I've been struggling with wrapping my head around the GEE beta coefficients and I don't think I fully get it. There are other questions on CrossValidated that ask about GEE in the binary context ...
2
votes
0answers
12 views

Simulating a Brownian Excursion using a Brownian Bridge?

I would like to simulate a Brownian excursion process (a Brownian motion that is conditioned always be positive when $0 \lt t \lt 1$ to $0$ at $t=1$). Since a Brownian excursion process is a Brownian ...
0
votes
0answers
3 views

Interpreting post-hoc kruskall wallis test results. Barchart V.S. Post Hoc results

I'm looking to see if there is a significant difference in the amount of fish at three sites. I've run a kruskall Wallis, which showed significant difference, followed by a post-hoc MWU pair-wise to ...
1
vote
0answers
13 views

Gender package confidence factor in R

R's gender package is a great library to determine gender from first names. I know that the package predicts the gender by calculating the proportion of male and female names given a range of years. ...
0
votes
0answers
11 views

ARIMA possible with multiple groups?

I’m looking to build an ARIMA model in R to help me predict the number of shots a football player is going to take in a game. I have last season's data to analyse to determine the optimal lags for ...
1
vote
1answer
30 views

Estimating population variance through simulation in R

I want to estimate the variance of the exponential distribution with a rate of $\lambda=0.2$. I'm drawing a sample of 5 exponentials 1000 times, and know that the theoretical variance of my ...
0
votes
0answers
22 views

(file) dependency tracking in Stata

As much of empirical research (or data analysis) has become a major software development exercise, practitioners use more and more such tools. So far I am aware of researchers using project ...
1
vote
1answer
20 views

Kruskall-Wallis test. How many degrees of freedom to report?

I have run a kruskall-wallis test to see if there is a significant difference in the amount of fish at each site. There are three sites (Site1, Site2 and Site3), with 80 observations of fish in each ...
1
vote
0answers
18 views

Random forest: Possibility to derive the characteristics of the predicted value?

Decision Trees stratify the feature space into different regions and fit the model in each region. With this method it's not difficult to derive the caracteristics of each individual taking the ...
0
votes
0answers
13 views

R: AOV Test to Determine Correlation Not Showing Significance?

I am using an ANOVA test in R to determine if there is a correlation between income and a binary indicator variable $I$. So I did: aov(formula=I~income, data=df) ...
1
vote
0answers
84 views

Problem with R-Squared value

I have a problem to determine my R-Squared value. I do a polynomial regression: fit3 <- lm(value ~ date + I(date^2)+ I(date^3),data=training) I have a R-Squared value (0.9416) when I do ...
6
votes
1answer
141 views

Difference in output between SAS's proc genmod and R's glm

I'm trying to replicate a model fitted in SAS in R but the fit I'm getting gives me slightly different coefficients and standard errors. Data: ...
0
votes
0answers
9 views

Polynomial ANCOVA glm in R

I have a data set of success and failure counts with one continuous independent variable and one factorial variable: ...
0
votes
0answers
26 views

How to analyse transfer function using R? [on hold]

I want to learn about using transfer function time series in R. But I don't know how to do it. Anyone know how to do it? Anyone know some references about using transfer function using R?
0
votes
0answers
15 views

How to plot plane on 3D axis [closed]

Consider following plot: How can i plot this plot in R with transparency and export final plot as PDF file?
1
vote
0answers
19 views

Simulating data from multilevel model

I am trying to simulate data from the following two-level model : $$Y_{ij}=\gamma_{00}+\gamma_{10}X_{ij}+\gamma_{01}Z_{j}+\gamma_{11}X_{ij}Z_j+u_{0j}+u_{1j}X_{ij}+e_{ij}$$ Three conditions are ...
0
votes
0answers
12 views

Obtaining significance for mixed GLMMs on count and binary data

I'm new to the software R and am trying to compute statistics on data from experiments on the offspring of lizards from two different thermal treatments - looking specifically at differences in their ...
0
votes
0answers
7 views

Mixed effects model, pseudoreplication in space, change through time

I have not found a good example for data with my structure. The data come from a long-term observational study. The response variable is growth rate, with one measurement from an individual fish. ...
0
votes
0answers
16 views

Is there a way to do logistic regression model selection of up to 5 variables each from a pool of ~70 variables

I'm trying to determine the best logistic regression model to estimate the probability of 0 in streamflow rates. My response for the glm object is one vector of the sum of all the days the recorded ...
0
votes
0answers
11 views

How to deal with a warning messages on lmer? [closed]

I ran a mixed model using lme4 for a logistic regression and got these warning messages. How to deal with it? Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = ...
0
votes
0answers
17 views

Calculating residuals for an exponential fit

We have a question about the proper interpretation of 'residuals' when doing an exponential fit. Right now we have the following R code: ...
0
votes
2answers
25 views

Can someone explain what the foldid argument in glmnet does?

I m trying to determine what alpha to use in my glmnet function, but the help file tells me: Note that cv.glmnet does NOT search for values for alpha. A ...
1
vote
1answer
39 views

What technique should be used to cluster urban areas

I am new to clustering algorithms. I want to cluster road junctions based on traffic, that is, intersections which have traffic between each other should be in one cluster. I also have a similarity ...
0
votes
0answers
5 views

Comparing variability of groups using indices

I have three genera of frogs (A, B, C), each containing a different number of species (14, 9, 18). The differences between species within a genus can in some cases be larger than the difference ...