[R] aov with Error and lme

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 18 13:39:21 CET 2003

There are worked examples in MASS (at least the last two editions) of
getting `the same results with lme as with aov with Error()'.

Your over-long lines make it difficult to see, but this appears to be very 
similar to examples both in MASS and in Pinheiro & Bates.  Have you 
consulted either?

On Tue, 18 Nov 2003, Karl Knoblick wrote:

> I searched in the list and only found questions
> without answers e.g.
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/19955.html
> : Is there a way to get the same results with lme as
> with aov with Error()?
> Can anybody reproduce the following results with lme:
> id<-c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5)
> factA<-c("al","al","al","al","al","al","al","al","al","al","al","al","al","al","al","a2","a2","a2","a2","a2","a2","a2","a2","a2","a2","a2","a2","a2","a2","a2","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3")
> factB<-c("B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3")
> Y<-c(56,52,48,57,54,46,55,51,51,58,51,50,54,53,46,54,50,49,53,49,48,56,48,52,52,52,50,55,51,46,57,49,50,55,51,47,56,48,51,58,50,48,58,46,52)
> df<-data.frame(id, factA, factB, Y)
> df$id<-as.factor(df$id)
> df.aov <- aov(Y ~ factA*factB + Error(factA:id),
> data=df)
> summary(df.aov)

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list