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,
The result is as follows
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,