[R] aov() and lme()

Jan Wiener jan.wiener at tuebingen.mpg.de
Thu Oct 27 13:14:59 CEST 2005


Sorry for reposting, but even after extensive search I still did not 
find any answers.

using: 
summary(aov(pointErrorAbs~noOfSegments*turnAngle+Error(subj/(noOfSegments+turnAngle)), 
data=anovaAllData ))

with subj being a random factor and noOfSegments and turnAngle being 
fixed factors, I get the following results:

----------------------------------------------
Error: subj
           Df Sum Sq Mean Sq F value Pr(>F)
Residuals 17 246606   14506

Error: subj:noOfSegments
              Df  Sum Sq Mean Sq F value   Pr(>F)
noOfSegments  3  7806.6  2602.2  5.3257 0.002864 **
Residuals    51 24919.4   488.6
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: subj:turnAngle
           Df Sum Sq Mean Sq F value  Pr(>F)
turnAngle  5  14660    2932  3.1707 0.01131 *
Residuals 85  78600     925
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Error: Within
                         Df Sum Sq Mean Sq F value    Pr(>F)
noOfSegments:turnAngle  15  19637    1309  2.9135 0.0001711 ***
Residuals              687 308687     449
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
------------------------------------------------------------------

all is fine, and I get  exactly the same results as with unix anova.


No I trying to fit the same data with lme and using the following call:

anova(lme(fixed=pointErrorAbs~noOfSegments*turnAngle, random=~1|subj, 
data=anovaAllData))

Unfortunately the results are 'really' different from the aov() 
procedure (I guess I have the call wrong):

----------------------------------------------------
(Intercept)                1   823 42.10888  <.0001
noOfSegments               3   823  5.19549  0.0015
turnAngle                  5   823  5.85379  <.0001
noOfSegments:turnAngle    15   823  2.61373  0.0007
----------------------------------------------------

I, however, need a comparable method for lme(), because in a different 
data set I have single empty cells and can therefore not use aov().

does anyone know how to fit with lme() to obtain the same results (for 
this balanced data set) as with aov().

Thanks in advance,
Jan




More information about the R-help mailing list