Factorial ANOVA & Interactions
Info sheet · Statistics for Psychology & Neuroscience
Warning✎ Editing notes — to do / to check
Working notes for the author — not shown to students once collapsed; remove before publishing.
- [ ]
What you’ll get from this sheet
By the end you should be able to:
- Say what a factorial ANOVA adds over a one-way ANOVA.
- Tell a main effect from an interaction — and read both off an interaction plot.
- Run a factorial ANOVA in R, Python, or MATLAB.
A factorial ANOVA has two (or more) factors at once. It gives you each factor’s main effect and their interaction — whether the effect of one factor depends on the level of the other.
From one factor to two
A one-way ANOVA looks at a single independent variable. But the world rarely cooperates with just one. Recall the Decade of Dance problem — decade affected danceability — but decade is unlikely to be the only thing that matters. A factorial ANOVA lets us throw in a second factor (and a third, and so on) and test them together.
With two factors we get two kinds of effect:
- A main effect is the effect of one factor on the outcome, ignoring the other — the effect of genre, say, averaged across all age ratings.
- An interaction is when the effect of one factor depends on the level of another. For example: a movie rated “7+” might score higher on Rotten Tomatoes if it’s an action-adventure rather than a drama. The effect of genre isn’t the same at every rating — that’s an interaction.
The neatest way to see an interaction is an interaction plot: put one factor on the x-axis and draw a line for each level of the other. Parallel lines mean no interaction; lines that fan apart or cross mean the effect of one factor changes with the other.
Make an interaction (or not)
Two factors: Genre (Drama vs Comedy) on the x-axis, and Rating (7+ vs 18+) as the two lines. Slide the effects and watch:
Set the interaction to 0 and the two lines run parallel — the gap between 7+ and 18+ is the same for Drama and Comedy, so genre’s effect doesn’t depend on rating. Crank the interaction up and the lines fan out or cross: now genre helps one rating and hurts the other. That crossing is the whole reason factorial ANOVA exists — and it’s exactly what running two separate one-way ANOVAs would miss.
See it in code
A 2 × 2 factorial ANOVA. The * gives you both main effects and their interaction in one shot:
score = [80 84 78 62 60 66 70 72 68 85 88 82];
genre = [1 1 1 1 1 1 2 2 2 2 2 2]; % 1 = Drama, 2 = Comedy
rating = [1 1 1 2 2 2 1 1 1 2 2 2]; % 1 = 7+, 2 = 18+
anovan(score, {genre, rating}, 'model','interaction', 'varnames',{'Genre','Rating'});Static reference — the R and Python tabs run live in the page.
TipCheck your understanding
On an interaction plot, what tells you there’s an interaction?
Whether the lines are parallel. Parallel lines mean the effect of one factor is the same at every level of the other → no interaction. Lines that fan apart or cross mean the effect changes with the other factor → an interaction.
When the interaction is significant, be very careful about reading the main effects on their own. An interaction means the effect of one factor isn’t the same across levels of the other, so the “average” main effect can be misleading (it might even be near zero while big, opposite effects hide inside). Interpret the interaction first, then the simple effects.
Where this shows up next
See Chapter 8 (ANOVA) for the full factorial treatment — spotting and following up interactions, contrasts within a factorial design, and why a factorial ANOVA beats running several one-way ANOVAs.