Skip to content
Prev 1852 / 7420 Next

marginal vs sequential results of lme

Basil,

I think that the issue is how lme (and R generally) parameterizes 
factorial models.  The "marginal" anova fits each effect after the 
others.  That does not produce what SAS calls type III sums of squares 
unless the model has no interactions or you use the "sum to zero" 
parameterization.

Consider a tiny example:

A  B
1  1
1  2
2  1
2  2

The default R design matrix will be:

int    A     B    A:B
   1    0      0     0
   1    0      1     0
   1    1      0     0
   1    1      1     1

Fitting columns sequentially gives the usual A, B and A:B sums of squares.
Fitting these "marginally", the B column will be added last, thus the 
anova will compare the full model to the model with only the int, A and 
A:B columns.  With only those three columns the model is constrained so 
that the first row A=1,B=1 has the same mean as the second row A=1,B=2, 
so the equality of those two means is the hypothesis tested.  That is 
not the same hypothesis as the type III B hypothesis.  The type III B 
null hypothesis is that the average of the means for rows 1 and 3 equals 
the average of the means for rows 2 and 4 (e.g. B low vs B high).

If you use the contr.sum option, then the design matrix will be:

int    A     B    A:B
   1    -1    -1     1
   1    -1     1    -1
   1    1     -1   -1
   1    1      1     1

These columns are orthogonal, so the order of fit does not matter and 
sequential SS's equal marginal SS's

Phil Chapman
On 1/20/2011 10:51 AM, Ben Bolker wrote: