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
Hi Jim,>> The decomposition of the sum of squares should be the same regardless of >> whether block is treated as random of fixed.Should it? By whose reckoning? The models you are comparing are different. Simple consideration of the terms listed in the (standard) ANOVA output shows that this is so, so how could the sum-of-squares be the same?>> I noticed that other people have asked similar questions in the past, but >> I haven't seen a >> satisfactory explanation.Maybe, but it has been answered (by me, and surely by others). However, canonical would be Venables and Ripley's MASS (: 283--286). The models you need to compare are the following: ## Aov.mod <- aov(Y ~ V * N + Error(B/V/N), data = oats) Lme.mod <- lme(Y ~ V * N, random = ~1 | B/V/N, data = oats) Lmer.mod <- lmer(Y~ V * N +(1|B)+(1|B:V)+(1|B:N), data = oats) summary(Aov.mod) anova(Lme.mod) anova(Lmer.mod) HTH, Mark Difford. -- View this message in context: http://r.789695.n4.nabble.com/ANOVA-table-and-lmer-tp3027546p3027662.html Sent from the R help mailing list archive at Nabble.com.
Like James Booth, I find the SSQ and MSQ in lmer output confusing. The F-ratio (1.485) for Variety is the same for aov, lme and lmer, but lmer's mean square for variety is 1.485 times the subplot residual mean square. In the conventional anova table for a split-plot expt, the variety mean square is 1.485 times *main-plot* residual mean square. -- ian m s white <i.m.s.white@ed.ac.uk> The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
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.