Guides / anova
ANOVA: a complete guide, with a worked example
ANOVA answers a question a t-test cannot: whether three or more groups differ. This guide explains how it partitions variance, works a one-way ANOVA through by hand, covers the assumptions and the robust alternatives when they fail, and shows how to follow a significant result through to a conclusion an examiner will accept.
ANOVA, or analysis of variance, tests whether the means of three or more groups differ by more than chance would produce. It works by comparing the variation between group means against the variation within groups; if the between-group variation is large relative to the noise, the F statistic is large and the difference is unlikely to be chance. A significant ANOVA shows that at least one group differs, but not which.
Definition
What ANOVA does, and why not just run t-tests
ANOVA compares three or more group means by splitting the total variation in your data into two parts: variation between the groups, and variation within them. If the between-group part is large relative to the within-group part, the groups probably differ.
The F statistic is the ratio of those two, each expressed as a mean square: F = MSₖₑₜ₣ₑₑₙ / MS₣ₓₜₕₓₙ. An F near 1 means the groups differ no more than the noise inside them already varies. A large F means they differ by more than noise explains.
It is worth being precise about what “variance” means here, because the name of the test misleads people into thinking it compares spreads rather than means. ANOVA does compare variances — but the between-groups variance it computes is driven entirely by how far apart the group means are. If the means were identical, the between-groups variance would be zero regardless of how spread out the individual scores were. So the test compares variances as a means to an end, and the end is a comparison of means. This is also why the F test and the t-test agree exactly when there are only two groups: with k = 2, F = t², and the two produce the same p-value on the same data.
Why not just run several t-tests?
Because the false positive rate compounds. Comparing four groups pairwise takes six t-tests, and at α = .05 the chance of at least one false positive rises to about 26%. ANOVA tests all groups in a single procedure at a single α, which is what keeps the error rate where you set it.
| Groups | Pairwise t-tests needed | Chance of ≥1 false positive |
|---|---|---|
| 3 | 3 | 14% |
| 4 | 6 | 26% |
| 5 | 10 | 40% |
| 6 | 15 | 54% |
It tells you at least one group differs from at least one other. It does not say which, or how many, or in what direction. That is what post-hoc tests are for, and stopping at the F is an incomplete analysis.
Choosing
The types of ANOVA
| Type | Design | Example |
|---|---|---|
| One-way | One factor, independent groups | Three teaching methods, different students in each |
| Two-way | Two factors, independent groups | Method × prior attainment, testing the interaction |
| Repeated measures | One factor, same participants throughout | Scores at baseline, 3 months and 6 months |
| Mixed | One between and one within factor | Two treatments measured at three time points |
| ANCOVA | With a continuous covariate controlled | Comparing methods, adjusting for baseline score |
The between-versus-within distinction matters as much here as it does for t-tests, and for the same reason: if the same people are measured repeatedly, their scores are correlated, and a between-groups ANOVA that ignores this discards the pairing and loses substantial power.
Interactions, which are usually the point
A two-way ANOVA gives three results: two main effects and one interaction. The interaction asks whether the effect of one factor depends on the level of the other — whether a teaching method works better for some students than others, for example. When an interaction is significant, interpret it first: the main effects can be misleading on their own, because an effect that is strongly positive in one subgroup and negative in another may average out to nothing.
Send your design and variables. A named statistician confirms the model, runs it, and returns annotated output with the post-hoc comparisons and effect sizes.
Get a fixed quoteAssumptions
Assumptions, and what to do when they fail
| Assumption | How to check | If violated |
|---|---|---|
| Independence | Study design | Use repeated measures or a mixed model |
| Normality of residuals | Q-Q plot, Shapiro-Wilk | Robust with large n; else Kruskal-Wallis |
| Homogeneity of variance | Levene’s test, spread plots | Welch’s ANOVA |
| No extreme outliers | Boxplots | Investigate; report with and without |
Sample size balance deserves particular attention here, because it interacts with the variance assumption in a way that catches people out. When group sizes are equal, ANOVA tolerates quite substantial differences in variance without much distortion. When they are unequal, the direction of the imbalance decides which way the test errs: a large variance paired with a small group makes the test too liberal, inflating false positives, while a large variance in a large group makes it too conservative. Neither is obvious from the output, which is why balanced designs are worth some effort at the recruitment stage.
Homogeneity of variance is the one that matters
ANOVA is fairly robust to non-normality, particularly with reasonable sample sizes, because the central limit theorem does much of the work. It is far less robust to unequal variances when group sizes are also unequal — that combination can push the actual false positive rate well above the nominal .05.
If Levene's test is significant, or group sizes differ markedly, use Welch's ANOVA. It does not assume equal variances, costs very little power when variances happen to be equal, and many statisticians now recommend it as the routine choice rather than the fallback. Pair it with Games-Howell post-hoc tests.
Note also that the normality assumption applies to the residuals, not to the raw data. Testing whether your outcome variable is normally distributed overall is the wrong check — with genuinely different group means, the combined distribution will look non-normal even when every group is perfectly normal.
Worked example
Worked example: one-way ANOVA by hand
Fifteen students are assigned to three revision methods, five per group. Exam scores follow.
| Group | Scores | Mean |
|---|---|---|
| A — spaced practice | 62, 68, 71, 65, 74 | 68.0 |
| B — massed practice | 55, 61, 58, 63, 53 | 58.0 |
| C — retrieval practice | 70, 76, 79, 73, 82 | 76.0 |
The grand mean is (68.0 + 58.0 + 76.0) / 3 = 67.33.
Step 1 — sum of squares between groups
SSₖ = Σ nₖ(x̄ₖ − x̄)²
= 5(68.0−67.33)² + 5(58.0−67.33)² + 5(76.0−67.33)²
= 5(0.449) + 5(87.05) + 5(75.17) = 2.24 + 435.25 + 375.85 = 813.33
Step 2 — sum of squares within groups
Each group's deviations from its own mean, squared and summed: group A gives 90.0, group B gives 68.0, group C gives 90.0.
SS₣ = 90.0 + 68.0 + 90.0 = 248.0
Step 3 — the ANOVA table
| Source | SS | df | MS | F |
|---|---|---|---|---|
| Between groups | 813.33 | 2 | 406.67 | 19.68 |
| Within groups | 248.00 | 12 | 20.67 | |
| Total | 1061.33 | 14 |
dfₖ = k − 1 = 2 and df₣ = N − k = 12. Dividing each SS by its df gives the mean squares, and their ratio is F.
Step 4 — the decision
The critical value for F(2, 12) at α = .05 is 3.89. Our F of 19.68 far exceeds it, giving p < .001. At least one group differs.
Two factors
Two-way ANOVA and the interaction
Adding a second factor gives you three tests for the price of one design: a main effect for each factor, and an interaction between them. The interaction is very often the reason the study was run.
What an interaction means
An interaction says the effect of one factor depends on the level of the other. A revision method that helps strong students and hinders weak ones has an interaction with prior attainment, even if, averaged across everyone, it appears to do nothing at all.
| Pattern | Main effects | Interaction | How to interpret |
|---|---|---|---|
| Both factors help equally at all levels | Both significant | Not significant | Report the main effects |
| Method helps only high-attainers | Possibly none | Significant | Interpret simple effects, not main effects |
| Method helps some, harms others | Often none | Significant | The main effect is actively misleading |
If a method raises scores by 6 points for one subgroup and lowers them by 6 for another, the main effect is zero. Reporting “the method had no effect” would be wrong for every single participant. Always inspect the interaction before interpreting main effects.
Simple effects
When the interaction is significant, follow it with simple effects analysis: test the effect of one factor separately at each level of the other. Rather than asking “does method matter?”, you ask “does method matter for high-attainers?” and “does method matter for low-attainers?” — two questions with potentially different answers, which is the whole point.
Reading the ANOVA table
| Source | df | F | p | Reading |
|---|---|---|---|---|
| Method | 1 | 2.14 | .147 | No overall difference |
| Attainment | 1 | 18.62 | <.001 | High-attainers score higher |
| Method × Attainment | 1 | 9.44 | .003 | Effect of method depends on attainment |
| Error | 84 |
Reading only the first row would produce the conclusion “method made no difference”. The third row shows why that would be wrong: the method does have an effect, in opposite directions for the two groups, and averaging them out is what produced the null main effect.
Follow-up
Post-hoc tests: finding which groups differ
A significant F licenses further comparison but does not perform it. Post-hoc tests compare pairs while controlling the error rate across the whole family of comparisons.
| Test | Use when | Notes |
|---|---|---|
| Tukey HSD | Equal variances, all pairwise comparisons | The standard choice |
| Games-Howell | Unequal variances or group sizes | Pair with Welch’s ANOVA |
| Bonferroni | A few planned comparisons | Conservative; loses power with many pairs |
| Dunnett | Comparing every group to one control | More powerful when this is the actual question |
For our example, Tukey HSD would compare A with B, A with C and B with C. Given group means of 68.0, 58.0 and 76.0 with a within-group mean square of 20.67, all three pairs separate clearly — retrieval practice beats spaced practice, which beats massed practice.
One structural point about post-hoc procedures: the number of comparisons grows quickly, and each is another chance for a false positive. Tukey HSD controls the error rate across the whole family of pairwise comparisons rather than each one separately, which is why its p-values are larger than uncorrected t-tests would give. That is the correction working as intended, not a loss of sensitivity to apologise for.
If you predicted before collecting data that retrieval practice would beat the other two, test that specific contrast rather than running all pairwise comparisons. Planned contrasts are more powerful, because you are asking one question instead of three. State them in your methods section, before the results.
Effect size
Effect size: eta squared and omega squared
| Measure | Formula | Notes |
|---|---|---|
| η² | SSₖ / SSₜₒₜₐₗ | Simple; biased upward in small samples |
| Partial η² | SSₖ / (SSₖ + SS₣) | What SPSS reports; not comparable across designs |
| ω² | (SSₖ − dfₖ × MS₣) / (SSₜₒₜ + MS₣) | Less biased; preferred where available |
For our example: η² = 813.33 / 1061.33 = 0.766 — the revision method accounts for about 77% of the variance in scores. That is implausibly large for real educational data, and reflects the tidy numbers chosen for the arithmetic rather than anything you should expect to see.
| η² | Conventional label |
|---|---|
| 0.01 | Small |
| 0.06 | Medium |
| 0.14 | Large |
Partial η² removes other factors from the denominator, so in a multi-factor design it can be substantially larger than η² and is not comparable across studies with different designs. If you quote the figure SPSS gives you, label it partial η² rather than η² — they are different quantities and reviewers notice.
Send your dataset. A named statistician runs the model, checks the assumptions, performs the appropriate post-hoc comparisons and returns APA tables.
See SPSS data analysisPitfalls
Seven mistakes that cost marks
1. Running multiple t-tests instead of an ANOVA
Six pairwise tests across four groups gives a 26% chance of a false positive. Use one ANOVA.
2. Stopping at a significant F
The F tells you a difference exists somewhere. Without post-hoc tests you cannot say where, and the analysis is unfinished.
3. Running post-hoc tests after a non-significant F
The omnibus F is what protects the family-wise error rate. Running pairwise comparisons after a non-significant F reintroduces exactly the inflation the ANOVA was there to prevent. Planned contrasts specified in advance are the exception, since they do not depend on the omnibus result.
4. Ignoring unequal variances
With unequal variances and unequal group sizes, the real error rate can far exceed .05. Use Welch's ANOVA.
5. Testing normality of the raw data
The assumption concerns the residuals. If group means genuinely differ, the pooled distribution will look non-normal regardless.
6. Interpreting main effects when the interaction is significant
In a two-way design, a significant interaction means the main effects may be misleading. Interpret the interaction first, usually with simple effects.
7. Using a between-groups ANOVA on repeated measures
It ignores the correlation between a participant's own scores, throws away the design's main advantage and usually hides a real effect.
Reporting
Reporting ANOVA in APA style
| Situation | How to write it |
|---|---|
| One-way, significant | F(2, 12) = 19.68, p < .001, η² = .77 |
| Not significant | F(2, 45) = 1.13, p = .331, η² = .05 |
| Welch’s | Welch’s F(2, 27.4) = 8.91, p = .001 |
| Interaction | F(2, 84) = 4.22, p = .018, partial η² = .09 |
| Post-hoc | Tukey HSD indicated C > A (p = .002) and C > B (p < .001) |
“Revision method significantly affected exam scores, F(2, 12) = 19.68, p < .001, η² = .77. Levene's test indicated equal variances (p = .89). Tukey HSD comparisons showed retrieval practice (M = 76.0) outperformed both spaced (M = 68.0, p = .002) and massed practice (M = 58.0, p < .001).”
Answers
Frequently asked questions
What is ANOVA used for?
To test whether three or more group means differ by more than chance would produce. It compares variation between the group means against variation within the groups, expressed as the F ratio. A significant result shows at least one group differs from another, but not which.
Why not just run multiple t-tests?
Because the false positive rate compounds. Comparing four groups needs six t-tests, and at α = .05 that gives roughly a 26% chance of at least one false positive. ANOVA tests everything in one procedure at one significance level, keeping the error rate where you set it.
What is the difference between one-way and two-way ANOVA?
One-way has a single independent variable; two-way has two, and additionally tests whether they interact. The interaction asks whether the effect of one factor depends on the level of the other, and it is usually the most interesting result in a two-factor design.
What do I do if Levene's test is significant?
Use Welch's ANOVA, which does not assume equal variances, together with Games-Howell post-hoc comparisons. Welch's costs very little power when variances are in fact equal, which is why many statisticians now recommend it as the default rather than the fallback.
What post-hoc test should I use?
Tukey HSD is the standard choice when variances are equal and you want all pairwise comparisons. Use Games-Howell for unequal variances, Dunnett when comparing every group against a single control, and Bonferroni for a small number of planned comparisons.
Can I run post-hoc tests if the ANOVA is not significant?
Generally no. The overall F controls the family-wise error rate, and running pairwise comparisons after a non-significant F reintroduces the inflation the ANOVA was protecting against. Planned contrasts specified in advance are the exception, as they do not depend on the omnibus result.
What effect size should I report for ANOVA?
Eta squared or omega squared, with omega squared preferred because it is less biased in small samples. Conventionally .01 is small, .06 medium and .14 large. If you quote the figure SPSS gives, label it partial eta squared, which is a different quantity and not comparable across designs.
What is the assumption of normality in ANOVA?
It applies to the residuals, not to the raw outcome variable. If the group means genuinely differ, the combined distribution will look non-normal even when each group is perfectly normal. Check normality within groups or inspect a Q-Q plot of the residuals.
Send the data. Get a fixed quote.
Attach your dataset or just describe the project. A named statistician replies with a price and a deadline, usually within one working day.