# [R] ANOVA table and lmer

JBooth-547 jb383 at cornell.edu
Wed Nov 10 18:04:50 CET 2010

```Hi Mark,

Thanks for your response. After some detective work I figured out the answer
to my question.

The models

> lm.split=lm(Y~B*V+B*N+V*N)
> lmer.split=lmer(Y~V+N+V:N+(1|B)+(1|B:V)+(1|B:N))

contain exactly the same terms. The difference is that blocking factor (B)
is fixed in first model but random in the second.
I stand by my statement that

>> The decomposition of the sum of squares should be the same regardless of
>> whether block is treated as random of fixed.

because the decomposition does not depend on distributional assumptions. It
is completely deterministic.

So why does the sum of squares for variety (V) produced by anova command
different for the two models?

> 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

> 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

The answer appears to be that the sums of squares and mean squares in the
lmer anova table are scaled by a ratio of the residual variance to a linear
combination of estimated variance components, so that dividing each mean
square by the residual variance gives the "correct" F-statistic. This
example is complicated by the fact that the REML estimate of the BN variance
is zero, which explains why the sum of squares for nitrogen (N) is not
rescaled and why the F-statistics are not all in agreement with the
classical ones given below.

Source   DFNum   DFDen  F Ratio
V           2            10          1.4853
N           3            15        55.9805
V*N       6             30         0.2603

Regards, Jim.

--
View this message in context: http://r.789695.n4.nabble.com/ANOVA-table-and-lmer-tp3027546p3036469.html
Sent from the R help mailing list archive at Nabble.com.

```