Skip to content

Discrepancy between R and SPSS in 2-way, repeated measures ANOVA

1 message · John Maindonald

#
There are 20 distinct individuals, right? expno breaks the 20
individuals into five groups of 4, right? Is this a blocking factor?

If expno is treated as a blocking factor, the following is what you get:

 > xy <- expand.grid(expno=letters[1:5],cond=letters[1:4],
+                                    time=factor(paste(1:2)))
 > xy$subj <- factor(paste(xy$expno, xy$cond, sep=":"))
 > xy$cond <- factor(xy$cond)
 > xy$expno <- factor(xy$expno)
 > xy$y <- rnorm(40)
 > summary(aov(y~cond*time+Error(expno/cond), data=xy))

Error: expno
           Df Sum Sq Mean Sq F value Pr(>F)
Residuals  4   3.59    0.90

Error: expno:cond
           Df Sum Sq Mean Sq F value Pr(>F)
cond       3   1.06    0.35    0.36   0.78
Residuals 12  11.86    0.99

Error: Within
           Df Sum Sq Mean Sq F value Pr(>F)
time       1   2.27    2.27    1.38   0.26
cond:time  3   3.27    1.09    0.67   0.59
Residuals 16  26.19    1.64


If on the other hand this is analyzed as for a complete
randomized design, the following is the output:

 > summary(aov(y~cond*time+Error(subj), data=xy))

Error: subj
           Df Sum Sq Mean Sq F value Pr(>F)
cond       3   1.06    0.35    0.37   0.78
Residuals 16  15.46    0.97

Error: Within
           Df Sum Sq Mean Sq F value Pr(>F)
time       1   2.27    2.27    1.38   0.26
cond:time  3   3.27    1.09    0.67   0.59
Residuals 16  26.19    1.64
On 10 Sep 2005, at 8:00 PM, Larry A Sonna wrote:

            
John Maindonald             email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473    fax  : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.