[R] aov versus lme

Volker Franz volker.franz at tuebingen.mpg.de
Fri Sep 27 11:33:55 CEST 2002


Hi, 

to my understanding, lme from Pinheiro & Bates nlme-library should
produce similar results as aov for (standard) repeated measure designs
(or am I wrong here?). For example, if I analyse the machines data set
with aov and with lme, I obtain similar results:

library( nlme )
data( Machines )
summary(aov(score ~ Machine + Error(Worker/Machine),Machines))
anova(lme(score ~ Machine, data=Machines, random = ~ 1|Worker/Machine))

Well, the machines example contains only one factor. Now, if I try to
do something similar on a design with two factors, I have trouble
specifying the random factor. For example: 

data2 <- data.frame(sub=as.factor(c(1,1,1,1,1,1,2,2,2,2,2,2,
                      3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5)),
                    a=as.factor(c(0,0,0,1,1,1,0,0,0,1,1,1,0,0,
                      0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1)),
                    b=as.factor(c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,
                      3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3)),
                    dv=c(60.4,60.8,59.8,56.3,65.3,57.1,39.1,
                      44.8,48.9,45.1,47.3,48.9,56.4,58.8,60.5,
                      58.6,58.9,61.2,58.0,60.1,64.3,57.3,59.8,
                      66.1,49.6,46.7,51.5,52.8,54.9,55.9))
summary(aov(dv ~ a * b + Error(sub/(a+b)),data2))
anova(lme( dv ~ a * b, data=data2, random = ~ 1 | sub/(a+b)))

The last line gives me an error. So --- how can I specify the random
effects for such a case? Do I have to use the pdMat class? I played a
bit with it --- but unfortunately without success.

Thanks for any help
Volker
-- 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list