One-way ANOVA explained: F test, Tukey, Dunnett and more

Updated

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:

MethodQuestionCritical value
TukeyWhich pairs differ? (all pairs, family error rate α)Studentized range q
Fisher LSDWhich pairs differ? (each pair at α, no family protection)t
DunnettWhich levels differ from a control?Dunnett's two-sided value
Hsu MCBWhich 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):

SupplierPeel strength (N/15 mm)MeanStDev
A (current)50.4, 51.6, 56.0, 53.6, 48.1, 52.051.952.70
B54.0, 55.9, 51.6, 56.1, 56.1, 59.355.502.56
C50.8, 51.2, 46.4, 55.4, 45.4, 52.650.303.78
D55.7, 54.4, 54.9, 54.9, 57.4, 56.255.581.10
Peel strength by film supplier45505560Peel strength (N/15 mm)ABCD
Peel strength by film supplier
SourceDFSSMSFP
Supplier3125.2341.745.680.006
Error20146.867.343
Total23272.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):

DifferenceEstimateTukey 95% CITukey adj. PFisher P
B − A3.55−0.83 to 7.930.1390.035
C − A−1.65−6.03 to 2.730.7200.304
D − A3.63−0.75 to 8.010.1260.031
C − B−5.20−9.58 to −0.820.0160.003
D − B0.08−4.30 to 4.461.0000.958
D − C5.280.90 to 9.660.0150.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.

Try it with your own data

StatLab SPC is free, open-source statistics for engineers. It runs in your browser, works offline, and never uploads your data.

Open StatLab