Skip to content
Prev 12672 / 20628 Next

Formula Explanation in lme4 Vignette

Hello,

In lme4 formula syntax, random effects factors are on the right side
of the pipe (|). On the left side, you can have only 1 or other fixed
effects factors to include interactions between fixed effects and
random effects factors.

So this example does not violate your lecture, saying that a factor
can be with random or fixed effects, not both : Subject is the random
effect factor, Days the fixed effects, and Days | Subject introduces
an interaction between them --- that is, the Subject random effect is
different for each Days level.

Hope this helps,
Best regards,
On Fri, Nov 14, 2014 at 12:00:17AM +0000, Dario Strbenac wrote:
? Hello,
? 
? In the software article vignette, it says that
? 
? resp ~ FEexpr + (REexpr1|factor1)
? 
? is the general format of mixed models. However, there's a sleep study example which has
? 
? fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
? 
? When I look at those two formulae, I see that Days matches both FEexpr and REexpr1. I thought that a factor could be a fixed effect or random effect, but not both. In lectures, I remember fixed and random effects as being exclusive, depending on if all the levels were measured, or just a subset of them.
? 
? --------------------------------------
? Dario Strbenac
? PhD Student
? University of Sydney
? Camperdown NSW 2050
? Australia
? 
? _______________________________________________
? R-sig-mixed-models at r-project.org mailing list
? https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models