Until Rune Haubo pointed out that he cannot see how these models (using the double-bar notation for factorial designs in the way I do in m1
) are relevant I was quite sure that they made sense:
library("lme4")
m1 <- afex::lmer_alt(angle ~ recipe + (recipe || replicate), cake)
He instead suggests that one should use
m2 <- lmer(angle ~ recipe +
(0 + dummy(recipe, "A") | replicate) +
(0 + dummy(recipe, "B") | replicate) +
(0 + dummy(recipe, "C") | replicate), cake)
or
m3 <- lmer(angle ~ recipe + (1 | replicate) +
(0 + dummy(recipe, "A") | replicate) +
(0 + dummy(recipe, "B") | replicate) +
(0 + dummy(recipe, "C") | replicate), cake)
which are different from m1
and equivalent to
m4 <- afex::lmer_alt(angle ~ recipe + (0 + recipe || replicate), cake)
and
m5 <- afex::lmer_alt(angle ~ recipe + (1|replicate) + (0 + recipe || replicate), cake)
I’m now quite puzzled because AFAICS you and others (but I don’t remember them) use m1
in the afex
vignettes and also here.
What is the correct way to specify a lmer_alt
model for categorical independent variables?