[R-sig-ME] What is the appropriate zero-correlation parameter model for factors in lmer?

Maarten Jung M@@rten@Jung @ending from m@ilbox@tu-dre@den@de
Thu May 17 12:43:29 CEST 2018

Dear list,

When one wants to specify a lmer model including variance components but no
correlation parameters for categorical predictors (factors) afaik one has
to convert the factors to numeric covariates or use lme4::dummy(). Until
recently I thought m2a (or equivalently m2b using the double-bar syntax)
would be the correct way to specify such a zero-correlation parameter model.

But in this thread [1] Rune Haubo Bojesen Christensen pointed out that this
model does not make sense to him. Instead he suggests m3 as an appropriate
I think this is a *highly relevant difference* for everyone who uses
factors in lmer and therefore I'm bringing up this issue again. But maybe
I'm mistaken and just don't get what is quite obvious for more experienced
mixed modelers.
Please note that the question is on CrossValidated [2] but some consider it
as off-topic and I don't think there will be an answer any time soon.

So here are my questions:
How should one specify a lmm without correlation parameters for factors and
what are the differences between m2a and m3?
Is there a preferred model for model comparison with m4 (this model is also
discussed here [3])?

data("Machines", package = "MEMSS")

d <- Machines
contrasts(d$Machine)  # default coding: contr.sum

m1 <- lmer(score ~ Machine + (Machine | Worker), d)

c1 <- model.matrix(m1)[, 2]
c2 <- model.matrix(m1)[, 3]
m2a <- lmer(score ~ Machine + (1 | Worker) + (0 + c1 | Worker) + (0 + c2 |
Worker), d)
m2b <- lmer(score ~ Machine + (c1 + c2 || Worker), d)
 Groups   Name        Std.Dev.
 Worker   (Intercept) 5.24354
 Worker.1 c1          2.58446
 Worker.2 c2          3.71504
 Residual             0.96256

m3 <- lmer(score ~ Machine + (1 | Worker) + (0 + dummy(Machine, "A") |
Worker) +
                                            (0 + dummy(Machine, "B") |
Worker) +
                                            (0 + dummy(Machine, "C") |
Worker), d)
 Groups   Name                Std.Dev.
 Worker   (Intercept)         3.78595
 Worker.1 dummy(Machine, "A") 1.94032
 Worker.2 dummy(Machine, "B") 5.87402
 Worker.3 dummy(Machine, "C") 2.84547
 Residual                     0.96158

m4 <- lmer(score ~ Machine + (1 | Worker) + (1 | Worker:Machine), d)

[1] https://stat.ethz.ch/pipermail/r-sig-mixed-models/2018q2/026775.html
[2] https://stats.stackexchange.com/q/345842/136579
[3] https://stats.stackexchange.com/q/304374/136579

Best regards,

	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list