This question already has an answer here:
- R's lmer cheat sheet 3 answers
How does the formula for the
lmer function work?
library('lmer') lmer(Yield~(1|Batch),Dyestuff) lmer(Yield~(Batch)*(1|rep(c(1,2,3),10)),Dyestuff) lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
On the left of
~ sign is the dependent variable and on the right comes all the independent variables separated by the
Is there any difference between
1|Batch mean? Does it have to do with the intercept? With being a random or a fixed effect?