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:
On 11-01-20 12:24 PM, Iannone, Basil wrote:
Dear R users,
I am having a problem with interpreting "anova" results of a linear mixed
effects model.
The data I am analyzing is from study that was set up as a randomized
block design with two factors at two levels. The model is:
m1<- lme(Y~A*B, random = ~1|Block)
The design is completely balanced and no data are missing. When I run a
sequential anova I get a p-value = 0.02 for factor B. When I run a
marginal anova (specified by "type = "marginal""), I get a p-value = 0.29
for factor B. The model summary ("summary (m1)" ) agrees with the marginal
test and shows a p-value = 0.29 for factor B. Further when I graph values
of Y against levels of B, I see no difference.
I thought that sequential and marginal anovas should produce the same
results when the design is balanced. Can someone please explain to me why
the results of the "anova(m1)" differ from the results of "anova(m1, type
= "marginal")" and "summary(m1)."
Thanks for your help,
Haven't spent a lot of time thinking this through, but I'm guessing
that the problem is with the interaction term.
Can you give a reproducible example (to save me the trouble of making
one up)?
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology