One-way ANOVA
ANOVA (analysis of variance) extends the independent t-test to three or more groups. Instead of running a t-test for every pair, which inflates the false-positive rate, ANOVA tests all the groups in one go. “One-way” means there is one grouping variable (one factor), such as teaching method, diet or dose.
The idea behind the F statistic
ANOVA compares two sources of variation:
- Between-group variation: how far the group means are from the overall mean.
- Within-group variation: how much individuals vary around their own group’s mean (the noise).
F = between-group mean square / within-group mean square
If the groups don’t differ, both estimate the same noise and F is around 1. If the group means really differ, the between-group part gets large and so does F.
- H₀: all group means are equal (μ₁ = μ₂ = … = μₖ).
- H₁: at least one group mean differs.
Assumptions
- Independent observations, with each participant in exactly one group.
- A continuous outcome.
- Approximately normal residuals within each group. This is fairly robust with moderate group sizes.
- Equal variances across groups, checked with Levene’s or Brown-Forsythe’s test. If they differ, use Welch’s ANOVA, which doesn’t assume equal variances.
If normality clearly fails, or the groups are small, use the Kruskal-Wallis test, the rank-based alternative (see parametric vs non-parametric tests).
Worked example: vitamin C dose and tooth growth
The ToothGrowth dataset (Crampton, 1947, built into R) records tooth growth in 60 guinea pigs given vitamin C at one of three daily doses: 0.5 mg, 1 mg or 2 mg, 20 animals each. Does mean tooth growth differ by dose? (The t-test lesson used the same animals to compare two delivery methods.)
Step 1: describe
| Dose | n | Mean | SD |
|---|---|---|---|
| 0.5 mg | 20 | 10.61 | 4.50 |
| 1 mg | 20 | 19.74 | 4.42 |
| 2 mg | 20 | 26.10 | 3.77 |
Step 2: check the assumptions
- Normality of residuals: D’Agostino-Pearson test p = .267, no evidence of a problem.
- Equal variances: Brown-Forsythe test p = .528. The SDs (3.77 to 4.50) are similar.
- Group size: 20 per group, which meets Analytika’s minimum for a parametric test.
All pass, so Analytika’s selector chooses the classic one-way ANOVA, with Tukey’s HSD for the follow-up comparisons.
Step 3: run the test
F-statistic: 67.4157 P-value: 9.533e-16 Eta-squared: 0.7029 df: 2, 57 N: 60 95% CI: [0.5671, 0.7854] 0.5 mg: mean=10.6050, n=20, sd=4.4998 1 mg: mean=19.7350, n=20, sd=4.4154 2 mg: mean=26.1000, n=20, sd=3.7742 Rows excluded for missing values: 0 of 60 === POSTHOC === 0.5 mg vs 1 mg: p_adj=0.0000, significant=yes, diff=-9.1300, ci=[-12.3582, -5.9018] 0.5 mg vs 2 mg: p_adj=0.0000, significant=yes, diff=-15.4950, ci=[-18.7232, -12.2668] 1 mg vs 2 mg: p_adj=0.0000, significant=yes, diff=-6.3650, ci=[-9.5932, -3.1368] Method used: tukey
> fit <- aov(len ~ dose, data = tg)
> summary(fit)
Df Sum Sq Mean Sq F value Pr(>F)
dose 2 2426 1213 67.42 9.53e-16 ***
Residuals 57 1026 18
> TukeyHSD(fit)
$dose
diff lwr upr p adj
1-0.5 9.130 5.901805 12.358195 0.00e+00
2-0.5 15.495 12.266805 18.723195 0.00e+00
2-1 6.365 3.136805 9.593195 4.25e-05Same F, p and Tukey intervals. Analytika lists each pair as “lower dose − higher dose”, so its differences are negative, while R’s are “higher − lower”. The ANOVA and Tukey templates are tested against R on every change.
Step 4: interpret
- F(2, 57) = 67.42, p < .001: there’s strong evidence that mean tooth growth differs across doses.
- η² = .70, 95% CI [.57, .79]: dose accounts for about 70% of the variation in tooth growth, a very large effect (see effect size).
- Tukey’s HSD: every pair differs, all p < .001. Going from 0.5 to 1 mg adds 9.13 units on average (95% CI 5.90 to 12.36), and going from 1 to 2 mg adds a further 6.37 (3.14 to 9.59).
Welch’s ANOVA, which drops the equal-variance assumption, gives F(2, 37.74) = 68.40, p < .001: the same conclusion.
Step 5: report it (APA 7)
A one-way ANOVA showed that tooth growth differed by vitamin C dose, F(2, 57) = 67.42, p < .001, η² = .70, 95% CI [.57, .79]. Tukey’s HSD comparisons indicated that growth was greater at 1 mg (M = 19.74, SD = 4.42) than at 0.5 mg (M = 10.61, SD = 4.50), and greater at 2 mg (M = 26.10, SD = 3.77) than at 1 mg, all ps < .001.
Post-hoc tests: which groups differ?
A significant ANOVA only says the means aren’t all equal. To find which pairs differ, use a post-hoc test that controls the overall error rate:
- Tukey’s HSD: the standard choice when variances are equal.
- Games-Howell: for unequal variances, so it pairs with Welch’s ANOVA.
- Dunn’s test with a correction: follows Kruskal-Wallis.
- Bonferroni or Holm: general-purpose corrections, more conservative.
If you had specific comparisons planned before collecting data (say, each dose vs a control), planned contrasts are more powerful than testing every pair.
Common mistakes
- Running multiple t-tests instead of ANOVA. With three groups the chance of at least one false positive rises from 5% to about 14%.
- Stopping at a significant F without saying which groups differ.
- Running post-hoc tests after a non-significant F and reporting whatever pair comes out significant.
- Using one-way ANOVA for repeated measurements of the same people. That needs repeated-measures ANOVA.
- Ignoring a second factor. ToothGrowth also varies the delivery method. A two-way ANOVA would test dose, supplement and their interaction together.
How to run it
- SPSS: Analyze → Compare Means → One-Way ANOVA. Add Tukey under Post Hoc, and tick the homogeneity of variance test and Welch under Options.
- R:
summary(aov(outcome ~ group, data = df)), thenTukeyHSD(). Useoneway.test()for Welch’s version. - Python:
scipy.stats.f_oneway(a, b, c), plusstatsmodelspairwise_tukeyhsd. - Analytika: ask whether the outcome differs across the groups. It runs the checks, chooses ANOVA, Welch’s ANOVA or Kruskal-Wallis, and adds the matching post-hoc test.
References
- Crampton, E. W. (1947). The growth of the odontoblasts of the incisor tooth as a criterion of the vitamin C intake of the guinea pig. The Journal of Nutrition, 33(5), 491–504.
More in Comparing groups
Try it with the free tools
Effect Size Calculator
Cohen's d, Hedges' g, eta squared, and conversions between effect size metrics — with the interpretation benchmarks.
Sample Size Calculator
How many participants do you actually need? Four calculators covering surveys, group comparisons, proportions, and correlations.
APA Table Formatter
Paste your numbers, get a properly formatted APA 7 table you can paste straight into Word, Markdown, or LaTeX.
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.