How one-way ANOVA works
ANOVA (analysis of variance) tests whether several group means are equal. It compares how far apart the group means are (between-group variation) with how spread out the values are inside each group (within-group variation).
df between = k − 1 df within = N − k
MSB = SSB ÷ (k − 1) MSW = SSW ÷ (N − k)
F = MSB ÷ MSW
Here k is the number of groups, N the total number of values, x̄ᵢ each group's mean and x̄ the grand mean. The p-value is the chance of an F this large or larger if all the true means were equal. It comes from the F distribution with k − 1 and N − k degrees of freedom, worked out with the regularized incomplete beta function (a continued fraction, accurate to about 9 or more significant digits).
Worked example
This is the resistor example from the NIST/SEMATECH e-Handbook, which is already filled in above. Three temperature levels each have 5 readings, so k = 3 and N = 15.
- Group means: 5.34, 7.72 and 8.56. The grand mean is 108.1 ÷ 15 = 7.20667.
- SSB = 5 × (5.34 − 7.20667)² + 5 × (7.72 − 7.20667)² + 5 × (8.56 − 7.20667)² = 17.4222 + 1.3176 + 9.1576 = 27.8973.
- SSW, adding the squared distances from each group's own mean: 4.992 + 4.868 + 7.592 = 17.452.
- MSB = 27.8973 ÷ 2 = 13.9487. MSW = 17.452 ÷ 12 = 1.45433.
- F = 13.9487 ÷ 1.45433 = 9.59, with 2 and 12 degrees of freedom, so p = 0.00325.
Since p is below 0.05, the temperature makes a difference. These figures match the ANOVA table NIST publishes for this data.
Getting a trustworthy result
- ANOVA assumes the groups are independent, roughly normal, and have similar spreads. Compare the group SDs in the result. A common rule of thumb is that the largest should be no more than about twice the smallest.
- A significant F says at least one mean differs, not which one. Follow up with a post-hoc test such as Tukey's HSD.
- With exactly 2 groups, one-way ANOVA gives the same p-value as a two-sample t-test with pooled variance, and F = t².
- η² (eta squared) is the share of the total variation explained by the groups. It shows how big the effect is, which a p-value doesn't.