Example of lmer() function in R documentation .

#1
How is the following code working ?

Code:
(fm1 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), cake, REML= FALSE))
In the formula of lmer :

What does 1 before vartical bar , (1|recipe:replicate) , indicate ?

How does "recipe:replicate" after vartical bar work ?

I tried :
Code:
cake$recipe:cake$replicate
But do not understand why are first 6 observations " A:1" , then the 6 observations " B:1" , and so on ?
 

Jake

Cookie Scientist
#2
The "1" represents the intercept term.

The notation "recipe:replicate" refers to the crossing of all levels of "recipe" with all levels of "replicate." So if there are 3 recipes (A, B, and C) and 3 replicates (1, 2, and 3), then there are 9 levels of the recipe*replicate crossing (A1, A2, A3, B1, B2, B3, C1, C2, C3).

All together, the notation "(1|recipe:replicate)" says to allow the intercept to vary randomly for each level of the recipe*replicate crossing.