The lme4
package in R includes the cake
dataset.
library(lme4)
head(cake[,2:4], 20)
recipe temperature angle
1 A 175 42
2 A 185 46
3 A 195 47
4 A 205 39
5 A 215 53
6 A 225 42
7 B 175 39
8 B 185 46
9 B 195 51
10 B 205 49
11 B 215 55
12 B 225 42
13 C 175 46
14 C 185 44
15 C 195 45
16 C 205 46
17 C 215 48
18 C 225 63
19 A 175 47
20 A 185 29
I've analysed the cake
dataset using two different models below. The first model is a 2 factor ANOVA:
summary(aov(angle ~ temperature + recipe, cake))
Df Sum Sq Mean Sq F value Pr(>F)
temperature 5 2100 420.1 6.918 4.37e-06 ***
recipe 2 135 67.5 1.112 0.33
Residuals 262 15908 60.7
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
...and the second is a mixed effects model, with temperature
as a random effect:
lmer(angle ~ recipe + (1| temperature), data=cake, REML=F)
Linear mixed model fit by maximum likelihood
Formula: angle ~ recipe + (1 | temperature)
Data: cake
AIC BIC logLik deviance REMLdev
1893 1911 -941.7 1883 1877
Random effects:
Groups Name Variance Std.Dev.
temperature (Intercept) 6.4399 2.5377
Residual 60.2560 7.7625
Number of obs: 270, groups: temperature, 6
Fixed effects:
Estimate Std. Error t value
(Intercept) 33.122 1.320 25.093
recipeB -1.478 1.157 -1.277
recipeC -1.522 1.157 -1.315
Correlation of Fixed Effects:
(Intr) recipB
recipeB -0.438
recipeC -0.438 0.500
Is someone able to provide a summary of what the mixed effect model has done differently to the ANOVA?