Home page for accesible maths 5.2 One-way ANOVA

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

5.2.1 ANOVA in R

Whilst it is useful to be able to caluclate an ANOVA by hand, especially whilst you are trying to understand what one is doing, it is very straightforward to do the whole process in R. First we will create an object that contains the ANOVA test, and then we simply need to extract the results,

> starlingsAnova <- aov(starlings)
> summary(starlingsAnova)

The result is as follows

Df Sum Sq Mean Sq F value   Pr(>F)
Roost        3  341.9  113.97   9.005 0.000139 ***
Residuals   36  455.6   12.66

Note that this presentation differs slights from the presentation above. The variation between groups is now attributed to the names of the grouping variable, in this case ‘Roost’. The within group variation is called instead the ‘Residual’ variation. This terminology is due to the link with linear regression models, which we will discuss further in the next chapter. The terminology that I have used previously is the terminology historically used when carrying out and ANOVA, and which is still used by many text books. The total variation is not given, but can be retrieved as the sum of the residual and group sums of squares,

SST=SSB+SSW=341.9+455.7=797.6.