I teach statistics at Masters level. I would like to teach mixed models without the Expected Mean Squares (EMS) approach from the old days . But I cannot get "lmer" to give me the right F-statistics.


Here is the data :

Y Fac1 Fac2
4 A 1
6 A 1
5 A 1
8 B 1
10 B 1
7 B 1
2 C 1
5 C 1
6 C 1
-6 A 2
-5 A 2
-4 A 2
0 B 2
-4 B 2
-5 B 2
-8 C 2
-7 C 2
-6 C 2


Fac1 has three levels (A, B and C) and Fac2 has two levels (1 and 2). I would like to treat Fac1 as fixed and Fac2 as random. The old "EMS formula" technique produces this ANOVA table:

         Df     Sum Sq       Mean Sq    EMS               F value
Fac1        2     49.78      24.89      6V1 + 3V1x2 + Ve    24.89/0.89 =  27.97
Fac2        1    533.56       533.56    9V2 + Ve           533.56/2.78 = 191.93
Fac1:Fac2   2      1.78     0.89        3V1x2 + Ve            0.8/2.78 =   0.32
Residuals   12    33.33     2.78        Ve


The fixed effect uses 0.89 as its denominator.

I cannot get lmer to give me that F-statistic of 27.97 for the fixed effect (Fac1).

Here is what I did with lmer:

fit <- lmer(Y ~ Fac1 + (Fac1 | Fac2))
    anova(fit)


Analysis of Variance Table

     Df Sum Sq Mean Sq F value
Fac1  2  49.02   24.51  10.294


This F-statistic of 10.29 is using the denominator 2.38, as can be seen from this summary of the random effects:

summary(fit)

Random effects:
 Groups   Name        Variance Std.Dev. Corr
 Fac2     (Intercept) 49.77980 7.05548
          Fac1B        0.88499 0.94074  1.000
          Fac1C        0.88500 0.94074  1.000 1.000
 Residual              2.38094 1.54303


The F-statistic should be using the 0.885 as the denominator, and not 2.38.

So what am I doing wrong? Where is my thinking wrong? How do I get lmer to use 0.89 as the denominator for the fixed effect F-statistic? Why does lmer gives different F-statistics from the classical approach to mixed modelling? As far as I can tell, it effectively uses the residual Mean Square as the denominator for the F-statistics for the fixed effects, something that was ruled out classically as incorrect.


My data set is deliberately simple, just to remove arithmetic complexity from the story ; I can produce the classical ANOVA table by hand, and so I know that it is arithmetically correct. So please no questions like "why do you want a factor with two levels to be random?". Thanks.


Pat Ward

	[[alternative HTML version deleted]]

