One-Way ANOVA: How It Works, Worked Example and Post-Hoc Tests
Reviewed by Prof. Dr. Alexander Holtermann · Updated 16 October 2026 · 6 min read
Analysis of variance (ANOVA) tests whether three or more group means differ. A significant F-test is followed by post-hoc tests such as Tukey HSD.
Key takeaways
- One-way ANOVA compares the means of three or more independent groups on one metric outcome in a single test, which keeps the Type I error rate at α.
- The F-statistic compares variability between groups with variability within groups:
F = MS_between / MS_within. - A significant F only says that at least one mean differs. Post-hoc tests (Tukey HSD, Games-Howell) show which groups differ.
- Report η² or ω² as the effect size: .01 small, .06 medium, .14 large.
- Assumptions mirror the t-test: independence, approximate normality within groups and equal variances. With unequal variances use Welch’s ANOVA; with ordinal or very skewed data the Kruskal-Wallis test.
Why not just run several t-tests?
With three groups you could run three t-tests (A vs. B, A vs. C, B vs. C). But each test carries a 5% risk of a false positive, and these risks accumulate: with three tests the chance of at least one false positive is about 14%. Analysis of variance (ANOVA) tests all groups at once with a single F-test and keeps the error rate at 5%.
The null hypothesis of one-way ANOVA is that all population means are equal: H₀: μ₁ = μ₂ = … = μ_k. The alternative is that at least one mean differs. The term “one-way” means there is one independent variable (factor) with several levels. Designs with two factors are called two-way or factorial ANOVA; repeated measurements of the same people require repeated-measures ANOVA.
The logic: variance between vs. within groups
ANOVA splits the total variability of the data into two parts. Between-group variability reflects how far the group means lie from the grand mean; it contains the effect of the factor plus random noise. Within-group variability reflects how much individuals differ inside each group; it is pure noise.
SS_total = SS_between + SS_within
Divide each sum of squares by its degrees of freedom to get mean squares (MS). If H₀ is true, both MS estimate the same noise and F is about 1. A clearly larger F indicates real differences between groups.
SS_between = Σ n_j (M_j − M_grand)², df = k − 1SS_within = Σ Σ (x − M_j)², df = N − kF = (SS_between / (k − 1)) / (SS_within / (N − k))
Worked example: three teaching formats
Fifteen students are randomly assigned to three formats and take the same quiz (points):
Lecture: 12, 14, 11, 15, 13 → M = 13.00, SD = 1.58 Flipped classroom: 15, 18, 16, 17, 14 → M = 16.00, SD = 1.58 Self-study: 10, 12, 8, 11, 14 → M = 11.00, SD = 2.24
Grand mean: 13.33. SS_between = 5 · (13 − 13.33)² + 5 · (16 − 13.33)² + 5 · (11 − 13.33)² = 63.33.
| Source | SS | df | MS | F | p |
|---|---|---|---|---|---|
| Between groups | 63.33 | 2 | 31.67 | 9.50 | .003 |
| Within groups | 40.00 | 12 | 3.33 | ||
| Total | 103.33 | 14 |
Post-hoc tests: which groups differ?
The F-test tells you that the means are not all equal, but not where the differences are. Post-hoc tests compare all pairs while controlling the familywise error rate. Tukey’s HSD is the standard with equal variances; Games-Howell is the choice with unequal variances or group sizes; Bonferroni or Holm corrections work for a few planned comparisons.
| Comparison (Tukey HSD) | Mean difference | 95% CI | p |
|---|---|---|---|
| Flipped vs. self-study | 5.00 | [1.92, 8.08] | .003 |
| Flipped vs. lecture | 3.00 | [−0.08, 6.08] | .057 |
| Lecture vs. self-study | 2.00 | [−1.08, 5.08] | .234 |
Assumptions and alternatives
One-way ANOVA has the same assumptions as the independent t-test, extended to k groups. It is fairly robust to non-normality with equal and not-too-small groups, but sensitive to unequal variances combined with unequal group sizes.
| Assumption | How to check | If violated |
|---|---|---|
| Independent observations | Study design | Repeated-measures or mixed models |
| Normality within groups (residuals) | Q-Q plot, Shapiro-Wilk per group | Larger n, transformation, or Kruskal-Wallis test |
| Equal variances | Levene’s test, ratio of largest to smallest SD | Welch’s ANOVA plus Games-Howell post-hoc tests |
| Metric outcome | Level of measurement | Kruskal-Wallis test for ordinal data |
Beyond one-way: factorial and repeated-measures ANOVA
If you add a second factor, for example teaching format × semester (first year vs. advanced), a two-way ANOVA tests two main effects and their interaction: does the effect of format depend on semester? Interactions are often the most interesting result, and a significant interaction means you should interpret main effects with care.
If the same students are measured at several time points, use repeated-measures ANOVA, which removes stable differences between people and adds the sphericity assumption (check with Mauchly’s test; correct with Greenhouse-Geisser if violated). With a covariate such as prior knowledge, the model is called ANCOVA. For partial effects in such designs, report partial η².
Planning and reporting an ANOVA
Plan the sample size with a power analysis. For a medium effect (Cohen’s f = .25), three groups, α = .05 and power .80 you need about 53 participants per group (159 in total). For the APA report, give descriptive statistics per group, the F-test with both degrees of freedom, p, an effect size, and the post-hoc results.
Doing this in SPSS, R or JASP
The menus differ, but the F statistic, degrees of freedom and p-value are the same. Remember to request an effect size and, if needed, post-hoc tests and Welch’s correction.
| Program | How to run it |
|---|---|
| SPSS | Analyze → Compare Means → One-Way ANOVA (Post Hoc: Tukey; Options: Homogeneity of variance test, Welch); for partial eta squared use Analyze → General Linear Model → Univariate → Options → Estimates of effect size |
| R | fit <- aov(score ~ group, data = df), then summary(fit) and TukeyHSD(fit); Welch ANOVA: oneway.test(score ~ group, data = df) |
| JASP / jamovi | ANOVA → ANOVA; tick effect size (η²) and add post-hoc tests in the Post Hoc Tests section |
| Stata | oneway score group, tabulate or anova score group |
Frequently asked questions
What is the difference between a t-test and ANOVA?
A t-test compares two means; ANOVA compares three or more in one test. With exactly two groups, one-way ANOVA and Student’s t-test are equivalent: F = t².
What does the F-value in ANOVA mean?
F is the ratio of between-group to within-group variance. Values around 1 suggest no group differences; large values suggest that at least one group mean differs.
Which post-hoc test should I use?
Tukey HSD when variances and group sizes are similar; Games-Howell when variances differ. For a few planned comparisons, Bonferroni- or Holm-corrected t-tests are fine.
What do I do if my ANOVA is significant but no post-hoc test is?
This can happen because post-hoc tests are more conservative or because the effect is spread across several groups. Report both results honestly and consider planned contrasts if you had specific predictions.
What is the non-parametric alternative to ANOVA?
The Kruskal-Wallis test for independent groups and the Friedman test for repeated measurements. Follow them with pairwise Mann-Whitney or Dunn tests with a correction.
Sources and further reading
- Howell, D. C. (2013). Statistical Methods for Psychology (8th ed.). Wadsworth Cengage Learning.
- Gravetter, F. J., & Wallnau, L. B. (2017). Statistics for the Behavioral Sciences (10th ed.). Cengage.
- Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum.
Your university’s examination regulations and style guide always take precedence.
Related articles
- t-testA t-test checks whether two means differ significantly: two independent groups, two paired measurements, or one mean against a fixed value.
- Effect sizeAn effect size tells you how large a difference or relationship is, independent of sample size. Cohen’s d of 0.2, 0.5 and 0.8 is small, medium, large.
- Type I and Type II errorsA Type I error is a false positive (rejecting a true null hypothesis, risk α); a Type II error is a false negative (missing a real effect, risk β).
- Choosing a statistical testYour research question, the level of measurement of your outcome, the number of groups and whether samples are paired decide which statistical test fits.
- Reporting statistics in APAAPA style reports test statistic, degrees of freedom, exact p-value and effect size, e.g. t(13.46) = 3.42, p = .004, d = 1.71. Examples for every test.
- Statistics software comparedSPSS and Stata are menu- or command-based commercial packages, R and Python are free code, JASP and jamovi are free point-and-click. Choose by field and task.