On Thu, 27 May 2004, [iso-8859-7] vasilis pappas wrote:

> Hello everybody,
>    I've been practicing with some data in R and SPSS and I noticed that there are 
> some differences in ANOVA results.
>  
> For example with :
> y<-c(1,2,34,2,3,45,2,1,67,3,2,67,2,2,98,4,4,23,1,1,23,2,3,45) and
> x<-rep(c(1,2,3),8)
>  
>    I get in R ( with summary(aov(y~x)) )
> MSres=350.7
> df=22
>  
>    while in SPSS I get
> MSres=221.9
> df=21
>  
> Can enyone explain me what is the problem or what am I doing wrong?

If you want to do a traditional one-way anova, you have to declare x
to be a factor:

> y<-c(1,2,34,2,3,45,2,1,67,3,2,67,2,2,98,4,4,23,1,1,23,2,3,45)
> x<-rep(c(1,2,3),8)
> summary(aov(y~x))
            Df Sum Sq Mean Sq F value    Pr(>F)    
x            1 9264.1  9264.1  26.414 3.761e-05 ***
Residuals   22 7715.9   350.7                      
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
> xf<-as.factor(x)
> summary(aov(y~xf))
            Df  Sum Sq Mean Sq F value    Pr(>F)    
xf           2 12320.1  6160.0  27.761 1.269e-06 ***
Residuals   21  4659.9   221.9                      
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 


Notice that when x is not a factor there is only one degree of freedom for 
x.

David Scott






_________________________________________________________________
David Scott     Department of Statistics, Tamaki Campus
                The University of Auckland, PB 92019
                Auckland        NEW ZEALAND
Phone: +64 9 373 7599 ext 86830         Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED] 


Graduate Officer, Department of Statistics

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to