Two-way ANOVA: how to run it and interpret the interaction
When an experiment crosses two factors, such as genotype and treatment, two-way ANOVA asks something a t test or one-way ANOVA cannot: whether the effect of one factor depends on the other (the interaction). Here is how to read the output, using the same numbers as the app’s sample.
What two-way ANOVA tests
| Test | Meaning | Example (genotype × treatment) |
|---|---|---|
| Main effect A | Do means differ across levels of A (averaging over B)? | Does tumor volume differ between WT and KO? |
| Main effect B | Do means differ across levels of B (averaging over A)? | Vehicle vs Drug |
| Interaction A × B | Does the effect of B depend on the level of A? | Is the drug effect different in WT and KO? |
- If your question is “does the knockout change the response?”, the interaction is the answer
- With a significant interaction, do not conclude from main effects alone (they are averages)
- Each combination (cell) needs at least two values; for independent (unpaired) data
- Same assumptions as one-way: independence, roughly normal cells, similar spread
Worked example
Wild-type (WT) and knockout (KO) mice received vehicle or drug, and tumor volume (mm³) was measured; six mice per cell (made-up data).
| Vehicle | Drug | Drug effect (Drug − Vehicle) | |
|---|---|---|---|
| WT | 11.00 ± 1.02 | 19.00 ± 1.58 | 8.00 |
| KO | 13.05 ± 1.14 | 25.90 ± 1.79 | 12.85 |
ANOVA table
| Source | SS | df | MS | F | P | Partial η² |
|---|---|---|---|---|---|---|
| Genotype | 120.15 | 1 | 120.15 | 59.70 | < 0.0001 | 0.75 |
| Treatment | 652.08 | 1 | 652.08 | 323.98 | < 0.0001 | 0.94 |
| Genotype × treatment | 35.28 | 1 | 35.28 | 17.53 | 0.00045 | 0.47 |
| Residual | 40.26 | 20 | 2.01 |
Each F is the effect’s mean square divided by the residual mean square (2.01). Residual df = N − number of cells = 24 − 4 = 20.
Interpreting the interaction
The interaction is significant: F(1, 20) = 17.53, P = 0.00045. The last column of the table shows why: the drug effect is 8.00 mm³ in WT but 12.85 mm³ in KO, 4.85 mm³ larger. In a 2×2 design, the interaction tests exactly this “difference of differences”.
On an interaction plot (cell means joined by lines), no interaction looks like parallel lines; an interaction makes them non-parallel. Here the KO − WT difference is 6.90 with drug versus 2.05 with vehicle.
Multiple comparisons
After a significant interaction, compare only the pairs that answer your question. Here WT and KO are compared within each treatment, with Šidák’s correction for the two comparisons (a correction suited to a few planned comparisons, also offered in GraphPad Prism’s two-way ANOVA).
| Comparison | Difference (KO − WT) | 95% CI | Adjusted P |
|---|---|---|---|
| Vehicle: WT vs KO | 2.05 | 0.07 to 4.03 | 0.042 |
| Drug: WT vs KO | 6.90 | 4.92 to 8.88 | < 0.0001 |
To compare every cell with every other (six pairs for four cells), use Tukey’s test. The more comparisons, the stricter each one, so limiting them to the ones you need improves power (the same logic as Tukey vs Dunnett).
Two-way ANOVA in Excel
In Excel, use Data → Data Analysis (Analysis ToolPak) → “Anova: Two-Factor With Replication”. Put levels of A down the left and levels of B across the top, with the replicates stacked in the same number of rows for each cell (“Rows per sample” = n).
- It only works with equal n in every cell. With unequal n, use software with Type III sums of squares.
- Excel’s “Sample”, “Columns”, “Interaction” and “Within” rows correspond to factor A, factor B, interaction and residual above.
- No multiple comparisons are produced; Šidák or Tukey must be computed separately.
How to report it
Main effects use the same format (genotype F(1, 20) = 59.70; treatment F(1, 20) = 323.98; both P < 0.0001). More in how to report statistics.
Common mistakes
- Separate t tests instead of an interaction test: “significant in KO but not in WT” is not evidence that the effects differ. Test the interaction.
- Concluding from main effects when the interaction is significant: a main effect is an average over the other factor.
- Using it for repeated measures: for repeated measurements of the same animals use repeated-measures ANOVA or a mixed model.
- Counting technical replicates as n: n is the number of independent animals or cultures.
Sources: Maxwell SE, Delaney HD, Kelley K (2018) Designing Experiments and Analyzing Data, 3rd ed., Routledge (two-way designs, interaction, Type III); Šidák Z (1967) J Am Stat Assoc 62:626–633; Microsoft Support (Excel Analysis ToolPak).
FAQ
What is the difference between one-way and two-way ANOVA?
One-way has a single factor (control and three doses); two-way has two crossed factors (genotype × treatment). You could compare the four 2×2 groups with one-way ANOVA, but then you cannot test directly whether the treatment effect differs between genotypes (the interaction).
If the interaction is not significant, do I just report main effects?
Broadly yes: without interaction the effects are roughly additive and the main effects describe them. But non-significant does not prove zero interaction, so still show the group means.
What if cell sizes are unequal?
The result depends on the type of sums of squares (I, II, III). GraphPad Prism and SPSS default to Type III, as does BenchFig. State which you used.
Can I use it for repeated measurements of the same animals?
No. Repeated measures need repeated-measures two-way ANOVA or a mixed model (BenchFig’s two-way analysis is for unpaired data).
Is there a nonparametric two-way ANOVA?
There is no single standard. Rank-based approaches (e.g. aligned rank transform) exist, but a transformation such as log often brings the data close enough to the ANOVA assumptions.
Related guides
Microsoft Excel is a trademark of Microsoft Corporation; GraphPad Prism is a trademark of GraphPad Software, LLC. Product and journal names are trademarks or registered trademarks of their respective owners.