0
$\begingroup$

This question already has an answer here:

How does the formula for the lmer function work?

Some examples:

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 + sign.

Is there any difference between + and *?

What does 1|Batch mean? Does it have to do with the intercept? With being a random or a fixed effect?

What does Day|Subjects mean?

$\endgroup$

marked as duplicate by chl May 15 '13 at 10:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    $\begingroup$ (1|Batch) means "one intercept per batch". $\endgroup$ – Stéphane Laurent May 15 '13 at 8:36
  • 1
    $\begingroup$ (Days|Subject) means a random intercept and a random slope for each subject. (1|Subject) would mean only a random intercept but a common slope across subjects. $\endgroup$ – COOLSerdash May 15 '13 at 9:18