ANOVA Formula (F-Test)
The one-way ANOVA F-test compares means across multiple groups.
Learn how to calculate the F-statistic with step-by-step examples.
The Formula
ANOVA (Analysis of Variance) tests whether the means of three or more groups are significantly different. Instead of running multiple t-tests, ANOVA handles all groups in a single test.
The F-statistic compares the variance between group means to the variance within the groups. If the between-group variance is much larger than the within-group variance, the group means are likely different.
A large F value suggests that the differences between groups are real, not just due to random variation. You compare the calculated F to a critical value from the F-distribution table at your chosen significance level.
Variables
| Symbol | Meaning |
|---|---|
| F | F-statistic (the test statistic for ANOVA) |
| MSB | Mean Square Between groups = SSB / dfB |
| MSW | Mean Square Within groups = SSW / dfW |
| SSB | Sum of Squares Between groups = Σ nj(x̄j − x̄)² |
| SSW | Sum of Squares Within groups = Σ Σ (xij − x̄j)² |
| dfB | Degrees of freedom between = k − 1 (k = number of groups) |
| dfW | Degrees of freedom within = N − k (N = total observations) |
Example 1
Three teaching methods are tested on groups of 5 students each. The test scores are: Method A: 85, 90, 88, 92, 85. Method B: 78, 82, 80, 76, 84. Method C: 92, 95, 89, 91, 93. Is there a significant difference between methods?
Calculate group means: x̄A = 88, x̄B = 80, x̄C = 92
Grand mean: x̄ = (440 + 400 + 460) / 15 = 1300 / 15 = 86.67
SSB = 5(88 − 86.67)² + 5(80 − 86.67)² + 5(92 − 86.67)²
SSB = 5(1.78) + 5(44.49) + 5(28.41) = 8.89 + 222.44 + 142.04 = 373.37
SSW = (sum of squared deviations within each group) = 30 + 40 + 20 = 90
MSB = 373.37 / (3 − 1) = 373.37 / 2 = 186.69
MSW = 90 / (15 − 3) = 90 / 12 = 7.5
F = 186.69 / 7.5 = 24.89 (with df = 2, 12 — this is highly significant, p < 0.001)
Example 2
A researcher has SSB = 120, SSW = 480, with 4 groups and 40 total observations. Calculate the F-statistic.
dfB = k − 1 = 4 − 1 = 3
dfW = N − k = 40 − 4 = 36
MSB = SSB / dfB = 120 / 3 = 40
MSW = SSW / dfW = 480 / 36 = 13.33
F = 40 / 13.33 = 3.0 (compare to F-critical at α = 0.05 with df = 3, 36 which is about 2.87 — marginally significant)
When to Use It
Use ANOVA when comparing means across three or more groups.
- Comparing treatment effects in medical or agricultural experiments
- Testing whether different teaching methods produce different results
- Analyzing whether product variations affect customer satisfaction differently
- Comparing performance across multiple machine settings in manufacturing
- Any time you would otherwise run multiple t-tests between pairs of groups