Two-Way ANOVA: Formula, Example and How to Calculate It by Hand

Two-way ANOVA looks at two grouping factors at once, such as fertiliser type and watering level. It tests three things: the effect of each factor on its own, and whether the two factors interact.

A worked example

Plants are grown with two fertilisers (F1, F2) at three watering levels (low, medium, high), with three plants in each of the six combinations. Mean heights in cm:

LowMediumHighRow mean
F113.016.018.015.7
F215.020.025.020.0
Column mean14.018.021.517.8

Open the two-way ANOVA calculator with this example loaded

SourceSSdfFp
Fertiliser84.5184.5< .001
Watering169.0284.5< .001
Fertiliser × Watering19.029.5.003
Error12.012

Reading the three results

Main effect of fertiliser: averaged over the watering levels, F2 plants grew taller (20.0 cm against 15.7 cm).

Main effect of watering: averaged over both fertilisers, more water meant taller plants.

Interaction: this is the interesting one. F2’s advantage is not the same at every watering level. At low water it is 2 cm. At high water it is 7 cm. The fertiliser helps most when the plants get plenty of water. A significant interaction means you can’t describe one factor’s effect without saying which level of the other factor you mean.

Spotting an interaction on a plot

Plot the cell means with one line per fertiliser, as the calculator does. Roughly parallel lines mean no interaction: the gap between fertilisers stays the same. Lines that spread apart, come together or cross mean an interaction. In this example the lines spread apart as water increases.

When there is an interaction, be careful with main effects

If the lines cross, a main effect can be misleading or even meaningless. Suppose a drug helps women and harms men by the same amount. The main effect of the drug, averaged over both sexes, is zero. Reporting “the drug had no effect” would hide the most important finding. When the interaction is significant, describe the effect of one factor separately at each level of the other (these are called simple effects).

Assumptions

The same as one-way ANOVA: independent observations, roughly normal residuals and similar variances across cells. Try to keep the number of observations per cell equal. With unequal cell sizes the calculator uses Type III sums of squares, which match SPSS’s default.

Check yourself

A 2 × 4 design has 5 observations per cell. What are the df for each effect and for error?

Factor A: 1. Factor B: 3. Interaction: 1 × 3 = 3. Total observations 40, so error df = 40 − 8 = 32.

Both main effects are significant, but the interaction is not. What does that tell you?

Each factor has an effect, and the effect of one is about the same at every level of the other. The lines on the interaction plot are close to parallel, so you can describe each factor on its own.