One-way ANOVA explained: F test, Tukey, Dunnett and more
One-way analysis of variance (ANOVA) tests whether the means of three or more groups differ, such as the strength of parts from four suppliers or the output of five machines. It compares the spread between group means with the spread within groups in a single F test. When the F test says the means differ, a multiple comparison method tells you which ones, while keeping the overall chance of a false alarm under control.
When to use it
- You have one categorical factor (supplier, machine, shift, recipe) with three or more levels, and a continuous response.
- You want one test instead of many 2-sample t-tests, which would inflate the chance of a false difference.
- You need to know which levels differ, compare new options with a current one, or pick the best.
If the data are far from normal or have outliers, consider Kruskal-Wallis. For two or more factors, or unbalanced data with covariates, use the general linear model. To compare each group with the overall mean on a chart, see analysis of means.
How it works
With k groups, nᵢ values in group i, group means ȳᵢ and grand mean ȳ, the total variation splits in two:
SS(Factor) = Σ nᵢ (ȳᵢ − ȳ)² SS(Error) = Σᵢ Σⱼ (yᵢⱼ − ȳᵢ)²Each divided by its degrees of freedom (k − 1 and N − k) gives a mean square, and their ratio is the F statistic:
F = MS(Factor) / MS(Error)If all the true means are equal, F follows an F distribution with (k − 1, N − k) degrees of freedom; a large F gives a small p-value. The pooled standard deviation S = √MS(Error) is the within-group spread, assuming every group has the same variance.
The F test only says that at least one mean differs. Four common methods then compare the means. Each answers a different question:
| Method | Question | Critical value |
|---|---|---|
| Tukey | Which pairs differ? (all pairs, family error rate α) | Studentized range q |
| Fisher LSD | Which pairs differ? (each pair at α, no family protection) | t |
| Dunnett | Which levels differ from a control? | Dunnett's two-sided value |
| Hsu MCB | Which levels could be the best? | Dunnett's one-sided value |
The family error rate is the chance of at least one false difference among all the comparisons. Tukey, Dunnett and MCB hold it at α; Fisher holds only each single comparison at α. For equal group sizes n, the half-width of each interval for a difference of two means is the critical value times S√(2/n), except Tukey's, which is q·S/√n.
Example
A packaging plant tests heat seals on a pouch made with film from its current supplier, A, and three candidates, B, C and D. Six pouches per supplier are pulled on a tensile tester; peel strength in N/15 mm (larger is better):
| Supplier | Peel strength (N/15 mm) | Mean | StDev |
|---|---|---|---|
| A (current) | 50.4, 51.6, 56.0, 53.6, 48.1, 52.0 | 51.95 | 2.70 |
| B | 54.0, 55.9, 51.6, 56.1, 56.1, 59.3 | 55.50 | 2.56 |
| C | 50.8, 51.2, 46.4, 55.4, 45.4, 52.6 | 50.30 | 3.78 |
| D | 55.7, 54.4, 54.9, 54.9, 57.4, 56.2 | 55.58 | 1.10 |
| Source | DF | SS | MS | F | P |
|---|---|---|---|---|---|
| Supplier | 3 | 125.23 | 41.74 | 5.68 | 0.006 |
| Error | 20 | 146.86 | 7.343 | ||
| Total | 23 | 272.09 |
S = 2.710, R² = 46.0%, R²(adj) = 37.9%. The means are not all equal (p = 0.006).
Comparisons with 95% family confidence (critical values for 4 groups and 20 error degrees of freedom: Tukey q = 3.958, Dunnett two-sided 2.540, one-sided 2.192; Fisher uses t = 2.086 per comparison):
| Difference | Estimate | Tukey 95% CI | Tukey adj. P | Fisher P |
|---|---|---|---|---|
| B − A | 3.55 | −0.83 to 7.93 | 0.139 | 0.035 |
| C − A | −1.65 | −6.03 to 2.73 | 0.720 | 0.304 |
| D − A | 3.63 | −0.75 to 8.01 | 0.126 | 0.031 |
| C − B | −5.20 | −9.58 to −0.82 | 0.016 | 0.003 |
| D − B | 0.08 | −4.30 to 4.46 | 1.000 | 0.958 |
| D − C | 5.28 | 0.90 to 9.66 | 0.015 | 0.003 |
Dunnett, against A: B − A, 95% CI −0.42 to 7.52 (adjusted p = 0.086); C − A, −5.62 to 2.32 (p = 0.596); D − A, −0.34 to 7.61 (p = 0.078).
Hsu MCB, larger is better (each mean minus the best of the others): A, −7.06 to 0; B, −3.51 to 3.35; C, −8.71 to 0; D, −3.35 to 3.51.
How to read the results
- Tukey: only C against B and D against C are clearly different. B and D may be better than A, but six pouches each cannot show it with all six pairs protected.
- Fisher: declares four differences, including B and D over A. With six comparisons each at 5%, the chance of at least one false difference is about 19% (family confidence 80.8%), so treat its extra findings as leads.
- Dunnett: the right method if the only question is "is any candidate better than our current film?" It is sharper than Tukey because it makes three comparisons, not six: p = 0.086 for B and 0.078 for D. Suggestive, not proven.
- Hsu MCB: an interval whose upper limit is 0 rules a level out as the best. A and C are ruled out; B and D remain candidates, and the data cannot separate them.
- The decision: choose B or D for a confirmation run with more pouches against A. D also has the smallest spread, which matters for a seal.
Common mistakes
- Running many t-tests. With four groups, six separate tests at 5% have about a 19% chance of at least one false difference.
- Choosing the comparison method after seeing the results. Decide on Tukey, Dunnett or MCB from the question, before the data come in.
- Ignoring unequal variances. Supplier C's standard deviation is 3.4 times D's. Check with a test for equal variances; if they differ a lot, use Welch's ANOVA and the Games–Howell comparisons.
- Reading "not significant" as "equal". Tukey cannot separate A from B here, but the interval runs up to 7.9 N/15 mm. A larger sample is the answer; see sample size for one-way ANOVA.
- Skipping the residuals. Check a normal probability plot and a plot of residuals in run order.
Frequently asked questions
What does the F value mean?
It is the ratio of the variation between group means to the variation within groups, each per degree of freedom. Near 1 means the group means differ no more than chance would produce.
Should I use Tukey or Fisher?
Tukey when you compare all pairs and want to control false alarms across the whole set. Fisher only for a few planned comparisons, or as a screen after a significant F test, knowing it finds more differences, including some false ones.
When do I use Dunnett instead of Tukey?
When one level is a control or a current standard and you only care about each other level against it. Fewer comparisons give narrower intervals.
What does Hsu's MCB tell me that the others do not?
Which levels can be ruled out as the best (or worst) and which remain candidates. It is made for choosing a winner.