Dear Bill,
I expect that the problem is in the contrasts that your student used for A
and B, though I haven't thought specifically about the context of a mixed
model. If he or she used the default contr.treatment(), then the contrasts
for different factors (and the interaction) are not orthogonal in the row
basis of the model matrix and hence are not orthogonal, even for balanced
data. Using, e.g., contr.sum() should provide A, B, and A:B contrasts that
are orthogonal to each other.
I hope this helps,
John
------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at
r-project.org]
On> Behalf Of Bill Shipley
> Sent: May-06-08 2:13 PM
> To: R help list
> Subject: [R] Type I or III SS with mixed model function lme
>
> Hello, I have come across a result that I cannot explain, and am hoping
that> someone else can provide an answer. A student fitted a mixed model using
the> lme function: out<- lme(fixed=Y~A+B+A:B, random=~1|Site). Y is a
continuous> variable while A and B are factors. The data set is balanced with the
same> number of observations in each combination of A and B. There are two
> hierarchical levels: Site and plots nested in site.
>
>
>
> He tried two different ways of getting theANOVA table: anova(out) and
> anova(out, type=marginal).
>
>
>
> Since the data were balanced, these two ways should (I think) give the
same> output since they correspond to Type I and III sums of squares in the SAS
> terminology. At least, this is the case with normal (i.e. not mixed)
linear> models. However, he finds very different results of these two types of
ANOVA> tables. Why?
>
>
>
> Bill Shipley
>
> North American Editor, Annals of Botany
>
> Dipartement de biologie
>
> Universiti de Sherbrooke
>
> Sherbrooke (Quibec) J1K 2R1
>
> Canada
>
> (819) 821-8000, poste 62079
>
> (819) 821-8049 FAX
>
>
>
> <http://pages.usherbrooke.ca/jshipley/recherche/>
> http://pages.usherbrooke.ca/jshipley/recherche/
>
>
>
>
> [[alternative HTML version deleted]]