Recall from Chapter 5 that a one-way ANOVA is a method for comparing the group means of three or more groups; an extension of the unpaired -test.
It turns out that the one-way ANOVA is a special case of a simple linear model, in which the explanatory variable is a factor with three or more levels, where each level represents membership of one of the groups.
Suppose that the factor has -levels, then the linear model for a one-way ANOVA can be written as
where is the indicator variable for the -th level of the factor.
The purpose of an ANOVA is to test whether the mean response varies between different levels of the factor. This is equivalent to testing
vs.
In turn, this is equivalent to a model selection between
: Model 1, where ; and
: Model 2, where .
Now, for model 1 states that all responses share a common population mean, our design matrix is simply a column of 1’s and , the overall sample mean. For model 2, the design matrix has columns, with
Therefore is an diagonal matrix, the diagonal entries of which correspond to the number of individuals in each of the groups,
, and is a vector of length , with -th entry being the sum of all the responses in group . It follows that
i.e. the least squares estimate of the -th regression coefficient is the observed mean of that group.
Calculating the sums of squares for the two models, we have
which, in ANOVA terminology, is what we referred to has the ‘total sum of squares’, and
which, in ANOVA terminology, is what we referred to as the within groups sum of squares.
Consequently, the -ratio for model selection can be shown to be identical to the test statistic used for the one-way ANOVA: