# [R] ANOVA table and lmer

James Booth jb383 at cornell.edu
Thu Nov 4 18:01:31 CET 2010

```The following output results from fitting models using lmer and lm to
data arising from a split-plot experiment (#320 from "Small Data Sets"
by Hand et al. 1994). The data is given at the bottom of this message.
My question is why is the sum of squares for variety (V) different in
the ANOVA table generated from the lmer model fit from that generated by
the lm model fit. The decomposition of the sum of squares should be the
same regardless of whether block is treated as random of fixed. Or am I
misinterpreting the ANOVA table from the lmer fit?

I noticed that other people have asked similar questions in the past,
but I haven't seen a satisfactory explanation.

Jim Booth.

> B=factor(block)
> V=factor(variety)
> N=factor(nitrogen)
> Y=yield
> lmm.split=lmer(Y~V+N+V:N+(1|B)+(1|B:V)+(1|B:N))
> anova(lmm.split)
Analysis of Variance Table
Df  Sum Sq Mean Sq F value
V    2   526.1   263.0  1.4853
N    3 20020.5  6673.5 37.6856
V:N  6   321.8    53.6  0.3028
> lm.split=lm(Y~B*V+B*N+V*N)
> anova(lm.split)
Analysis of Variance Table
Response: Y
Df  Sum Sq Mean Sq F value    Pr(>F)
B          5 15875.3  3175.1 15.4114 1.609e-07 ***
V          2  1786.4   893.2  4.3354   0.02219 *
N          3 20020.5  6673.5 32.3926 1.540e-09 ***
B:V       10  6013.3   601.3  2.9188   0.01123 *
B:N       15  1788.2   119.2  0.5786   0.86816
V:N        6   321.7    53.6  0.2603   0.95103
Residuals 30  6180.6   206.0
>
> split
block variety nitrogen yield
1      1       1        0   111
2      1       1        1   130
3      1       1        2   157
4      1       1        4   174
5      1       2        0   117
6      1       2        1   114
7      1       2        2   161
8      1       2        4   141
9      1       3        0   105
10     1       3        1   140
11     1       3        2   118
12     1       3        4   156
13     2       1        0    61
14     2       1        1    91
15     2       1        2    97
16     2       1        4   100
17     2       2        0    70
18     2       2        1   108
19     2       2        2   126
20     2       2        4   149
21     2       3        0    96
22     2       3        1   124
23     2       3        2   121
24     2       3        4   144
25     3       1        0    68
26     3       1        1    64
27     3       1        2   112
28     3       1        4    86
29     3       2        0    60
30     3       2        1   102
31     3       2        2    89
32     3       2        4    96
33     3       3        0    89
34     3       3        1   129
35     3       3        2   132
36     3       3        4   124
37     4       1        0    74
38     4       1        1    89
39     4       1        2    81
40     4       1        4   122
41     4       2        0    64
42     4       2        1   103
43     4       2        2   132
44     4       2        4   133
45     4       3        0    70
46     4       3        1    89
47     4       3        2   104
48     4       3        4   117
49     5       1        0    62
50     5       1        1    90
51     5       1        2   100
52     5       1        4   116
53     5       2        0    80
54     5       2        1    82
55     5       2        2    94
56     5       2        4   126
57     5       3        0    63
58     5       3        1    70
59     5       3        2   109
60     5       3        4    99
61     6       1        0    53
62     6       1        1    74
63     6       1        2   118
64     6       1        4   113
65     6       2        0    89
66     6       2        1    82
67     6       2        2    86
68     6       2        4   104
69     6       3        0    97
70     6       3        1    99
71     6       3        2   119
72     6       3        4   121

```