CalculatorsToolsGuides 日本語
BenchFig › Guides › One-way ANOVA and Tukey’s multiple comparisons: a worked example
Statistics

One-way ANOVA and Tukey’s multiple comparisons: a worked example

To compare three or more group means, run a one-way ANOVA to ask whether any difference exists, then a multiple-comparison test such as Tukey’s to show which groups differ, rather than repeating t tests. This worked example shows where every number in the ANOVA table comes from.

Updated: BenchFig日本語
Run a one-way ANOVA on your own dataPaste a table from Excel: F, P, η², Tukey or Dunnett comparisons and a results sentence (Welch and Kruskal–Wallis too).Calculate →

What one-way ANOVA tests

One-way ANOVA tests whether the means of three or more levels of a single factor (e.g. treatment) are all equal. The F ratio compares the spread between group means with the spread within groups.

Key points
  • F = between-group mean square ÷ within-group mean square; about 1 if there is no difference
  • ANOVA says only that some difference exists; multiple comparisons say where
  • Three repeated t tests raise the chance of a false positive to up to about 14% (1 − 0.953)
  • Assumptions: independence, roughly normal groups, similar spread

Worked example

Control, Drug A and Drug B, five samples each.

Grand mean 13.627. Made-up example values.
GroupValuesMeanSD
Control12.1, 13.4, 11.8, 12.9, 13.012.640.666
Drug A14.2, 15.1, 13.6, 14.8, 15.514.640.750
Drug B13.0, 14.1, 12.6, 13.9, 14.413.600.765
05101520ControlDrug ADrug BResponse (a.u.)**nsns
Example data (made up, n = 5 each). Bars = mean, error bars = SD, dots = samples. Brackets: Tukey’s multiple comparisons (**P < 0.01; ns, not significant). Drawn with BenchFig.

1. Between-group sum of squares

SSbetween = Σ ni(x̄i − x̄)2 = 5(12.64 − 13.63)2 + 5(14.64 − 13.63)2 + 5(13.60 − 13.63)2 = 10.005

2. Within-group sum of squares

SSwithin = Σ (ni − 1)si2 = 4 × (0.6662 + 0.7502 + 0.7652) = 6.364

3. Mean squares and F

Divide each sum of squares by its degrees of freedom (between = groups − 1 = 2; within = N − groups = 15 − 3 = 12).

ANOVA table. BenchFig’s results match SciPy (scipy.stats.f_oneway).
SourceSSdfMSFP
Between groups10.00525.0039.430.0035
Within groups (residual)6.364120.530
Total16.36914

F(2, 12) = 5.003 ÷ 0.530 = 9.43, P = 0.0035: the three means are not all equal. Effect size η2 = SSbetween ÷ SStotal = 0.61.

Tukey’s multiple comparisons

Tukey’s test compares every pair of groups (three pairs here) while keeping the overall error rate at 5%, using the within-group mean square (0.530) from the ANOVA.

q = |x̄i − x̄j|√(MSwithin / n)  → P from the studentized range distribution (3 groups, df = 12)The 95% critical q is 3.773, so the 95% CI of each difference is ±3.773 × √(0.530 / 5) = ±1.229.
Difference = right group − left group. Tukey P values match SciPy (scipy.stats.tukey_hsd).
ComparisonDifferenceqTukey P95% CI(For reference) uncorrected t test P
Control vs Drug A2.006.140.00250.77 to 3.230.0021
Control vs Drug B0.962.950.135-0.27 to 2.190.067
Drug A vs Drug B-1.043.190.101-2.27 to 0.190.062

Only Control vs Drug A (difference 2.00) is significant. Uncorrected t tests give smaller P values; here the conclusion is the same, but with more comparisons the correction matters more. If the question is only “does each drug differ from control?”, Dunnett’s test is the better choice (Tukey vs Dunnett).

ANOVA and Tukey on sample dataOpen a 3+ group sample or paste from Excel. Switch between all pairs (Tukey) and vs control (Dunnett); brackets and asterisks are placed automatically.
Open for free →

One-way ANOVA in Excel

Use Data → Data Analysis (Analysis ToolPak) → “Anova: Single Factor”, with groups in columns. The output shows SS, df, MS, F, P-value and F crit.

How to report it

Groups were compared by one-way ANOVA (F(2, 12) = 9.43, P = 0.0035, η² = 0.61). By Tukey’s multiple comparisons test, Drug A was 2.00 higher than control (95% CI 0.77 to 3.23, P = 0.0025), whereas Drug B vs control (P = 0.135) and Drug A vs Drug B (P = 0.101) did not differ significantly (n = 5 per group).

See how to report statistics and significance asterisks. For two crossed factors (genotype × treatment), use two-way ANOVA.

Sources: Montgomery DC (2017) Design and Analysis of Experiments, 9th ed., Wiley; Hsu JC (1996) Multiple Comparisons: Theory and Methods, Chapman & Hall (Tukey’s method); Kramer CY (1956) Biometrics 12:307–310 (unequal n).

FAQ

If ANOVA is significant, do I know which groups differ?

No. ANOVA only says that at least one difference exists. Use Tukey’s, Dunnett’s or another multiple-comparison test to find which.

ANOVA was not significant but a Tukey comparison was. Is that possible?

Yes. Tukey’s and Dunnett’s tests control the error rate on their own and do not require a significant ANOVA. Report both.

Can group sizes differ?

Yes. ANOVA handles unequal n, and Tukey’s test becomes the Tukey–Kramer test. If both n and variances differ, consider Welch’s ANOVA with Games–Howell.

I only want to compare each group with control.

Use Dunnett’s test: fewer comparisons, more power than Tukey (see Tukey vs Dunnett).

What if the data are not normal?

Use the Kruskal–Wallis test with Dunn’s test, or transform the data (e.g. log) before ANOVA.

Run ANOVA and Tukey on sample dataPaste three or more groups into the graph screen to get one-way ANOVA with Tukey’s test, significance brackets and ready-to-use methods and results sentences.
Open for free →
Your own data, all the way to the final figure.Loading your files, saving, and journal-ready export (PDF, TIFF, PNG, SVG) are in BenchFig Pro for Windows, updated based on researchers’ requests: ¥3,980/year (2 PCs), with lab and perpetual licenses too.
About the app →

Related guides

Microsoft Excel is a trademark of Microsoft Corporation. Product and journal names are trademarks or registered trademarks of their respective owners.