From Group Measurements to an F Test
A one-way ANOVA calculation brings several quantities together: the average for each treatment group, the overall average, variation between group averages, and variation among observations within groups. In a balanced design, every treatment group has the same number of observations. This makes the grand mean and between-groups sum of squares especially straightforward to calculate.
The calculation is useful because a difference among sample means alone does not show whether the population treatment means differ: sample means vary even when the population means are equal. The omnibus F test compares between-groups variation with within-groups variation, which estimates the background error variation under the one-way model.
The one-way model is \(Y_{ij}=\mu_i+\varepsilon_{ij}\), where \(\mu_i\) is the population mean for treatment group \(i\). For the standard F test, errors are assumed independent, normally distributed with mean zero, and to have a common variance \(\sigma^2\): \(\varepsilon_{ij}\sim N(0,\sigma^2)\). The experimental units must be independent, and the error variation must be reasonably consistent across treatment groups. The hypotheses for the omnibus test are \(H_0:\mu_1=\mu_2=\cdots=\mu_a\) versus \(H_a:\) not all treatment means are equal.
The Quantities to Calculate
The grand mean is the average of all observations. With equal group sizes, it is also the simple average of the \(a\) group means. The three sums of squares describe total, between-groups, and within-groups variation:
The between-groups calculation uses each group mean’s squared distance from the grand mean, multiplied by the number of observations represented by that mean. The within-groups calculation instead uses each observation’s distance from its own group mean. The total sum of squares uses each observation’s distance from the grand mean.
The corresponding degrees of freedom are \(a-1\) for between groups, \(N-a\) for within groups, and \(N-1\) for total. Divide each sum of squares by its degrees of freedom to obtain its mean square. The F statistic is the between-groups mean square divided by the within-groups mean square.
When the model assumptions hold and \(H_0\) is true, this statistic follows an F distribution with \(a-1\) numerator degrees of freedom and \(N-a\) denominator degrees of freedom. The p-value is the probability, under that null model, of an F statistic at least as large as the observed one. The test uses the upper tail because larger values indicate that the group means vary more than would be expected from within-group error variation alone.
Why the Sums of Squares Add Up
A useful calculation check is that total variation equals between-groups variation plus within-groups variation. For each observation, write its deviation from the grand mean as a within-group deviation plus a group-mean deviation:
After squaring and summing, the cross-product term is zero: within any group, \(\sum_{j=1}^{n}(y_{ij}-\bar{y}_{i.})=0\). The remaining between-groups part repeats the group-mean deviation \(n\) times. Therefore:
This identity is an arithmetic check, not an extra assumption. If the calculated sums do not add up, check the group means, grand mean, and squared deviations.
Worked Example: A Small F Statistic
In a hypothetical experiment, three treatment groups each contain three independent experimental units. The measured outcome, in points, is: Group A, 4, 5, 6; Group B, 5, 6, 7; Group C, 6, 7, 8. Suppose the design and model checks support independent, approximately normal errors with a common variance. Calculate the ANOVA quantities and test at \(\alpha=0.05\).
The group means are \(\bar{y}_{1.}=5\), \(\bar{y}_{2.}=6\), and \(\bar{y}_{3.}=7\). The grand mean is \(\bar{y}_{..}=(5+6+7)/3=6\) points. Here \(a=3\), \(n=3\), and \(N=9\).
The between-groups sum of squares is \(SS_{\text{Between}}=3[(5-6)^2+(6-6)^2+(7-6)^2]=3(1+0+1)=6\) points squared. Within each group the observations are one point below, at, and one point above its mean, so each group contributes \(1+0+1=2\) points squared. Thus \(SS_{\text{Within}}=2+2+2=6\) points squared.
For the total sum of squares, the squared deviations from 6 are \(4+1+0\) in Group A, \(1+0+1\) in Group B, and \(0+1+4\) in Group C. Therefore \(SS_{\text{Total}}=5+2+5=12\) points squared, which checks because \(6+6=12\).
The degrees of freedom are \(df_{\text{Between}}=3-1=2\), \(df_{\text{Within}}=9-3=6\), and \(df_{\text{Total}}=9-1=8\). The mean squares are \(MS_{\text{Between}}=6/2=3\) and \(MS_{\text{Within}}=6/6=1\), each in points squared. Hence \(F=3/1=3.00\), with 2 and 6 degrees of freedom.
For \(F(2,6)\), the upper-tail p-value at 3.00 is 0.125. Since \(0.125>0.05\), do not reject \(H_0\). These data do not provide statistically significant evidence at the 5% level that the three population treatment means differ. This result does not establish that the means are equal.
A Larger Separation Relative to Within-Group Variation
The next example uses non-integer group means and a smaller within-groups mean square. As before, the values are hypothetical. Assume the observations come from independent units, and that the experimental setup and appropriate checks support the normal-error and common-variance assumptions. With small samples, the observed data alone cannot establish those assumptions.
Worked Example: A Larger F Statistic
Three equally sized groups each have four observations, measured in millimetres: Group A, 10, 12, 11, 11; Group B, 12, 14, 13, 13; Group C, 14, 15, 13, 14. Find the sums of squares and test the omnibus null hypothesis at \(\alpha=0.05\).
The group means are 11, 13, and 14 mm. The grand mean is \((44+52+56)/12=152/12=12.667\) mm. Thus \(a=3\), \(n=4\), and \(N=12\).
The between-groups sum of squares is \(SS_{\text{Between}}=4[(11-12.667)^2+(13-12.667)^2+(14-12.667)^2]\). Using the exact grand mean \(38/3\), this equals \(4[(25+1+16)/9]=56/3=18.667\) mm squared.
Within each group the deviations from its mean are \(-1,1,0,0\), in some order. Each group therefore contributes \(1+1+0+0=2\) mm squared, giving \(SS_{\text{Within}}=6\) mm squared. The decomposition gives \(SS_{\text{Total}}=56/3+6=74/3=24.667\) mm squared.
The degrees of freedom are 2 between groups, 9 within groups, and 11 total. The mean squares are \(MS_{\text{Between}}=(56/3)/2=28/3=9.333\) mm squared and \(MS_{\text{Within}}=6/9=0.667\) mm squared. Therefore \(F=(28/3)/(2/3)=14.0\), with 2 and 9 degrees of freedom.
The upper-tail p-value for \(F(2,9)=14.0\) is approximately 0.0017. Since this is below 0.05, reject \(H_0\). The data provide evidence that not all three population treatment means are equal. The omnibus result does not specify which means differ.
Checking the Calculation and the Conclusion
A reliable calculation keeps the quantities distinct: the grand mean summarizes all observations, between-groups variation measures the spread of group means around that grand mean, and within-groups variation measures spread around each group’s own mean. The sum-of-squares identity checks the arithmetic; the F ratio and its p-value address the null hypothesis.
- Check the balance: confirm that every group has the same \(n\) before using the balanced formulas.
- Check the grand mean: calculate it from all observations, or average the group means when the groups are equally sized.
- Check the decomposition: verify \(SS_{\text{Total}}=SS_{\text{Between}}+SS_{\text{Within}}\), allowing for small rounding differences.
- Check degrees of freedom: the between and within degrees of freedom should add to the total, since \((a-1)+(N-a)=N-1\).
- Keep the conclusion in scope: a significant omnibus test indicates evidence that at least one population mean differs, not which particular groups differ.
Worked Example: Another Balanced Calculation
A hypothetical measurement in units is recorded for three independent groups of three units each: Group A, 8, 9, 10; Group B, 9, 10, 11; Group C, 11, 12, 13. Assume the design and model checks support independent, normal errors with a common variance. Calculate the F statistic and give the test conclusion at the 5% level.
The group means are 9, 10, and 12 units. The grand mean is \((27+30+36)/9=93/9=10.333\) units. With \(a=3\), \(n=3\), and \(N=9\), \(SS_{\text{Between}}=3[(9-10.333)^2+(10-10.333)^2+(12-10.333)^2]\). Using exact deviations \(-4/3,-1/3,5/3\), this is \(3(16+1+25)/9=14\) units squared.
Each group has deviations \(-1,0,1\) from its mean, so \(SS_{\text{Within}}=3(1+0+1)=6\) units squared. By the decomposition, \(SS_{\text{Total}}=14+6=20\) units squared. The degrees of freedom are 2 between groups, 6 within groups, and 8 total. Thus \(MS_{\text{Between}}=14/2=7\), \(MS_{\text{Within}}=6/6=1\), and \(F=7/1=7.00\).
The upper-tail p-value for \(F(2,6)=7.00\) is 0.027. Since \(0.027<0.05\), reject \(H_0\): the measurements provide evidence that not all three population means are equal. The test does not by itself identify the differing groups, and it does not show that treatment caused a difference unless the design supports a causal interpretation.
Check Your Understanding
Use the definitions and calculation steps above to answer these questions.
- In a balanced design with four groups and five observations per group, what are \(a\), \(n\), and \(N\)?
- Why does the grand mean equal the simple average of the group means in a balanced design?
- For three groups of equal size, the group means are 2, 4, and 6, and each group has four observations. Calculate \(SS_{\text{Between}}\).
- If \(SS_{\text{Within}}=18\) and there are 15 observations across three groups, calculate the within-groups degrees of freedom and \(MS_{\text{Within}}\).
- What does a statistically significant omnibus F test establish, and what does it leave unanswered?