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

Larry A Sonna larry_sonna at hotmail.com
Fri Sep 9 16:10:06 CEST 2005

Dear R community,

I am trying to resolve a discrepancy between the way SPSS and R handle 
2-way, repeated measures ANOVA.

An experiment was performed in which samples were drawn before and after 
treatment of four groups of subjects (control and disease states 1, 2 and 
3).  Each group contained five subjects.  An experimental measurement was 
performed on each sample to yield a "signal".  The before and after 
treatment signals for each subject were treated as repeated measures.  We 
desire to obtain P values for disease state ("CONDITION"), and the 
interaction between signal over time and disease state ("CONDITION*TIME").

Using SPSS, the following output was obtained:
                      DF        SumSq (Type 3)    Mean Sq    F value     P=

COND              3                 42861            14287       3.645 

TIME                1                     473               473       0.175 

COND*TIME     3                     975               325       0.120 

Error                16                43219             2701

By contrast, using the following R command:

summary(aov(SIGNAL~(COND+TIME+COND*TIME)+Error(EXPNO/COND), Type="III"))

the output was as follows:

                  Df     Sum Sq     Mean Sq     F value  Pr(>F)

COND          3          26516       8839      3.2517     0.03651 *

TIME            1            473         473      0.1739     0.67986

COND:TIME  3            975         325      0.1195     0.94785

Residuals     28        76107      2718

I don't understand why the two results are discrepant.  In particular, I'm 
not sure why R is yielding 28 DF for the residuals whereas SPSS only yields 
16.  Can anyone help?

E-mail replies would be much appreciated.  I can be reached at 
larry_sonna at yahoo.com and at larry_sonna at hotmail.com

Thanks in advance,

Larry Sonna

More information about the R-help mailing list