[R] lme and aov

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Aug 3 21:52:58 CEST 2007

Gang Chen wrote:
> I have a mixed balanced ANOVA design with a between-subject factor  
> (Grp) and a within-subject factor (Rsp). When I tried the following  
> two commands which I thought are equivalent,
>  > fit.lme <- lme(Beta ~ Grp*Rsp, random = ~1|Subj, Model);
>  > fit.aov <- aov(Beta ~ Rsp*Grp+Error(Subj/Rsp)+Grp, Model);
> I got totally different results. What did I do wrong?
Except for not telling us what your data are and what you mean by 
"totally different"?

One model has a random interaction between Subj and Rsp, the other does 
not. This may make a difference, unless the interaction term is aliased 
with the residual error.

If your data are unbalanced, aov is not guaranteed to give meaningful 


More information about the R-help mailing list