Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 442

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`.

7 votes

Mixed effects model: Compare random variance component across levels of a grouping variable

One relatively straight-forward way could be to use likelihood-ratio tests via anova as described in the lme4 FAQ. We start with a full model in which the variances are unconstrained (i.e., two diffe …
Henrik's user avatar
  • 14.4k
4 votes
Accepted

Specifying contrasts using afex

Thanks a lot for reporting this. It is indeed a mistake in the documentation. This and all the following contrasts were wrong. I guess when I wrote the code the ordering of the factor was different or …
Henrik's user avatar
  • 14.4k
7 votes

Why does lmer (unlike SAS) output a non-zero variance of random effect if it is also include...

The default behavior for lme4::lmer is to use restricted maximum likelihood estimation. If you switch to 'pure' maximum likelihood estimation, the result of 0 variance replicates: l2 <- lmer(y ~ (1|s …
Henrik's user avatar
  • 14.4k
6 votes
Accepted

Are these maximal linear mixed models (within-subject within-item factorial design) really m...

Models m2 and m3 can only be estimated if you have repetitions on the level of the participant-item combination. For m3 for the full factorial design. Otherwise this random effect is confounded with t …
Henrik's user avatar
  • 14.4k
9 votes

What to do with random effects correlation that equals 1 or -1?

I agree with everything said in amoeba's answer which provides a great summary of the current discussion on this issue. I will try to add a few additional points and otherwise refer to the handout of …
Henrik's user avatar
  • 14.4k
13 votes
Accepted

Encoding of categorical variables (dummy vs. effects coding) in mixed models

The full quote from our chapter also provides an answer to your second question (i.e., the why): A common contrast scheme, which is the default in R, is called treatment contrasts (i.e., contr.treatment …
Henrik's user avatar
  • 14.4k
3 votes
Accepted

testing contrast in two-way ANOVA using multcomp

This can be solved by using the ingenious combination of afex with lsmeans (and also multcomp if one desires so, but this is usually not necessary). Furthermore, thanks to afex functionality to aggreg …
Henrik's user avatar
  • 14.4k
3 votes

ANCOVA intercepts - does R center data?

R uses treatment-contrasts per default with the consequence that the intercept corresponds to the mean value of the first group. … No, R does not center numerical variables automatically for ANCOVA. You have to do this by hand. …
Henrik's user avatar
  • 14.4k
14 votes
2 answers
7k views

What is the lme4::lmer equivalent of a three-way repeated measures ANOVA?

My question is based on this response which showed which lme4::lmer model corresponds to a two-way repeated measures ANOVA: require(lme4) set.seed(1234) d <- data.frame( y = rnorm(96), subjec …
Henrik's user avatar
  • 14.4k
2 votes
Accepted

fitting LMEMs for repeated measures with no correlation between intercept and slope

That is quite simple: For your data, estimating the correlation, doesn't improve the fit at all. Hence, the p-values need to be identically. > deviance(ml3) [1] 10910.52 > deviance(ml2) [1] 10910.52 …
Henrik's user avatar
  • 14.4k
6 votes

Warning messages from mixed model (glmer)

I think that the main issue is that you need to increase the number of possible iterations the optimizer is allowed to have (in my humble opinion the default of 10,000 is a little low). This is what i …
Henrik's user avatar
  • 14.4k
3 votes

Using glmer to estimate treatment interactions

As I said in my comment, I expect the problem to be one of additional random effects parameters in model compared to in modelT0 + modelT1 (specifically corraletions). Hence I would first check for th …
Henrik's user avatar
  • 14.4k
1 vote

How to test whether the effects of predictors on one DV explains their effects on another in...

As the Miller & Chapman (2001) paper explains in great detail, using a covariate that is correlated with the independent variables is usually a bad idea. Hence simply adding study to the model will le …
Henrik's user avatar
  • 14.4k
9 votes
Accepted

How to specify mixed ANOVA with multiple repeated measures and covariate in R

First of all, you really need to make sure, that adding a covariate makes any sense. Adding a covariate only makes sense, if the covariate is not correlated with the independent variable (i.e., if the …
Henrik's user avatar
  • 14.4k
7 votes
1 answer
7k views

How to do Simple Confirmatory Factory Analysis/SEM in R?

I would like to run a confirmatory factor analysis (which essentially is a structural equation model) in R testing this. There are at least two mature packages of doing so sem and openMX. …
Henrik's user avatar
  • 14.4k

15 30 50 per page