One-way ANOVA using R

 

Same data (mpg) and same variable (hwy and cyl). The R code is pretty simple:

> summary(aov(hwy ~ factor(cyl), data = mpg))

 Df Sum Sq Mean Sq F value Pr(>F) 
factor(cyl) 3 4836 1612.1 108.2 <2e-16 ***
Residuals 230 3425 14.9 
---
Signif. codes: 0 ?**?0.001 ?*?0.01 ??0.05 ??0.1 ??1

> print(aov(hwy ~ factor(cyl), data = mpg))

Call:
 aov(formula = hwy ~ factor(cyl), data = mpg)

Terms:
 factor(cyl) Residuals
 Sum of Squares 4836.211 3425.451
 Deg. of Freedom 3 230

Residual standard error: 3.85918
 Estimated effects may be unbalanced

 

 

See Also:

Do the same test in SAS

 

Leave a Reply

Your email address will not be published. Required fields are marked *