Dear R-Users,

 

I'm trying to set up a repeated measures anova with two within subjects
factors. I tried it by 3 different anova functions: aov, Anova (from car
package) and lme (from nlme package). I managed to get the same results with
aov and Anova, but the results that I get from lme are slightly different
and I don't figure out why. I guess I did not set up the error structure
correctly. Here's an example, that I analysed with the 3 different anova
functions:

 

set.seed(10)

df<-data.frame(Time=as.factor(rep(paste('t',1:3,sep=''),each=36)),Cond=as.fa
ctor(paste('c',1:4,sep='')),Subj=as.factor(rep(paste('s',1:9,sep=''),each=4)
),y=rnorm(108))

 

summary(aov(y ~ (Time*Cond) + Error(Subj/(Time*Cond)), data = df))

 

library(nlme)

anova(lme(y~Time*Cond,random=~1|Subj,data=df))

 

df2<-cast(df,Subj~Time+Cond)[-1]

mod<-lm(cbind(t1_c1,t1_c2,t1_c3,t1_c4,t2_c1,t2_c2,t2_c3,t2_c4,t3_c1,t3_c2,t3
_c3,t3_c4)~1,df2)

idata=data.frame(Time=gl(3,4),Cond=gl(4,1))

summary(Anova(mod,idata=idata,idesign=~Time*Cond),multivariate=F)

 

 

I would highly appreciate if anyone could explain why the results are
slightly different. I probably spent hours to find an answer on the
internet. I would like to use the lme function, because I need to do
multiple comparisons with ghlt function.

 

Regards,

 

Erich

 


	[[alternative HTML version deleted]]


