[R] lme: reproducing example

Karl Knoblick karlknoblich at yahoo.de
Tue Dec 2 11:34:54 CET 2003


Dear R-community!

I still have the problem reproducing the following
example using lme.

id<-factor(rep(rep(1:5,rep(3,5)),3))
factA <- factor(rep(c("a1","a2","a3"),rep(15,3)))
factB <- factor(rep(c("B1","B2","B3"),15))
Y<-numeric(length=45)
Y[ 1: 9]<-c(56,52,48,57,54,46,55,51,51)
Y[10:18]<-c(58,51,50,54,53,46,54,50,49)
Y[19:27]<-c(53,49,48,56,48,52,52,52,50)
Y[28:36]<-c(55,51,46,57,49,50,55,51,47)
Y[37:45]<-c(56,48,51,58,50,48,58,46,52)
df<-data.frame(id, factA, factB, Y) 
df.aov <- aov(Y ~ factA*factB + Error(factA:id),
data=df)
summary(df.aov)

Is there a way to get the same results with lme as 
with aov with Error()? HOW???

One idea was the following:
df$factAid=factor(paste(as.character(df$factA),":",as.character(df$id),sep=""))
df.lme <-
lme(Y~factA*factB,df,random=~1|factAid,method="REML") 
The degrees of freedom look right, but the F values
don't match aov.

Hope somebody can help! Thanks!!

Karl




More information about the R-help mailing list