Home › Block 4 › Unit 14
UNIT 14 · BLOCK 4

🪟 Two-Way ANOVA

Two factors at once — and the famous picture that reads itself.

📖 Deep reading · ⏱ ~18 min
🎯 Why this matters

This is the finale — you've earned it. All year you've asked, "does one thing matter?" Now you can ask, "do two things matter — and do they matter together?" That last word is the whole game. The real world almost never lets one cause act alone: a drug works differently by age, a teaching method helps beginners but not experts, a stressor lands hard on one group and bounces off another. A two-way ANOVA is built to catch exactly that. By the end of today you'll look at a single line graph and say, out loud, what three different results are hiding inside it. One picture, three answers. Let's finish strong.

By the end you can…

1. The big idea — two factors, three tests

Back in Unit 13, one-way ANOVA let you compare three or more groups on one grouping variable — that variable is called a factor. A two-way ANOVA takes the natural next step: it studies two factors at the same time. The word "two-way" literally means "two factors." A 2×2 design (say it "two-by-two") is the simplest case — two factors, each with two levels. Two levels times two levels gives four groups, one for every combination.

Here's the payoff and the twist. Because you're crossing two factors, you don't get one answer — you get three, and each one gets its own F test:

Result (its own F-test)Plain EnglishThe question it answers
Main effect of Factor A (the rows)The overall effect of Factor A, averaging over Factor BDoes Factor A move scores overall?
Main effect of Factor B (the columns)The overall effect of Factor B, averaging over Factor ADoes Factor B move scores overall?
A × B interactionThe two factors team upDoes the effect of one depend on the level of the other?

Two main effects plus one interaction — three separate F ratios, each tested for significance on its own. That third one, the interaction, is new this unit, and it's the star of the show. Crucially, the interaction is not "the two main effects added together" — it's a genuinely separate question that the first two tests can't answer.

Why one test isn't enough

You could run two separate one-way ANOVAs — one per factor — but you'd never see the interaction. The interaction is the part that says "the effect of one factor changes depending on the other," and it only appears when both factors live in the same analysis. That's the whole reason to run a two-way ANOVA instead of two one-ways.

Check A study crosses two factors (each with two levels) in one analysis. How many F-tests does the two-way ANOVA produce?
Three. Two factors give two main effects (one per factor), plus the interaction between them — three separate F tests, each judged on its own. That third test, the interaction, is the reason you run a two-way ANOVA instead of two one-ways.

2. Cell means and marginal means — the raw material

Everything in a two-way ANOVA is built from averages of a 2×2 grid. Two kinds of averages matter, and keeping them straight is most of the battle.

Here's the layout. The four inner numbers are cell means; the bold edge numbers are marginal means:

B₁ (Col 1)B₂ (Col 2)Row marginal
A₁ (Row 1)cell A₁B₁cell A₁B₂mean of row A₁
A₂ (Row 2)cell A₂B₁cell A₂B₂mean of row A₂
Col marginalmean of col B₁mean of col B₂grand mean

Read it like a map. The main effect of Factor A compares the two row marginals (far-right column). The main effect of Factor B compares the two column marginals (bottom row). The interaction lives inside the four cells — it asks whether the gap between cells changes from one row to the next. Same four numbers, three different questions.

Worked step by step: our Vegan Study

Our class Vegan Study has 2 factors: country (USA, UK) and diet (omnivore, vegan), with 50 people in each of the 4 cells and self-compassion (1–5) as the score. Here are the 4 cell means, to 3 decimals so your hand math matches Sheets:

OmnivoreVeganMarginal mean (row)
USA3.1743.4463.31
UK3.3683.0393.20
Marginal mean (column)3.273.24
  1. Average across each row (ignore diet). USA: (3.174 + 3.446) ÷ 2 = 3.310 → 3.31. UK: (3.368 + 3.039) ÷ 2 = 3.2035 → 3.20.
  2. Compare the row margins: the main effect of country. 3.31 vs 3.20, a gap of only 0.11. Probably no main effect of country (the F-test agrees: p = .182).
  3. Average down each column (ignore country). Omnivore: (3.174 + 3.368) ÷ 2 = 3.271 → 3.27. Vegan: (3.446 + 3.039) ÷ 2 = 3.2425 → 3.24.
  4. Compare the column margins: the main effect of diet. 3.27 vs 3.24, a gap of 0.03. Probably no main effect of diet (p = .719).
  5. Now look inside each row: the interaction. Vegan − omnivore is +0.27 in the USA (3.446 − 3.174) but −0.33 in the UK (3.039 − 3.368). One plus, one minus: the diet effect flips. That is an interaction (p < .001), and it is how a crossover hides a main effect.

Averaging the 2 cell means gives the marginal mean here because every cell has the same number of people (50). In Sheets, =AVERAGEIF(B5:B204, "USA", D5:D204) gives the same 3.31 in 1 step. Round only at the end: rounding the cell means first can leave you 1 hundredth away from Sheets.

3. Main effects — the "overall" effects

A main effect is the effect of one factor, averaging over the other. It's the marginal-means comparison, in words:

Main effects are the big picture — one factor at a time, the other one blurred out. Each gets its own F ratio (the same logic as Unit 13: between-groups variance over within-groups variance), and you decide each one with the familiar rule — if p < .05, reject the null for that effect; otherwise fail to reject it. "Fail to reject" — never "accept" — because absence of evidence isn't evidence of absence.

4. The interaction — the "it depends" effect

An interaction means the effect of one factor depends on the level of the other. That's the whole definition: it depends. The factors aren't acting alone — they're teaming up. In the table, you spot it by asking whether the gap between the two cells in one row is different from the gap in the other row. If Factor B helps a lot in Row 1 but barely at all in Row 2, B's effect depends on A — that's an interaction.

The one definition to keep

An interaction means the effect of one factor DEPENDS on the other. A study tip might help beginners a lot but do nothing for experts — the tip's effect depends on who you are. That dependence is the interaction.

And here's the subtle part that trips people up: an interaction can hide a main effect. If one group's scores rise while another's fall by about the same amount, the two changes cancel when you average them — so the main effect can look flat (non-significant) even though something dramatic is happening. The story isn't "nothing happened." The story is "it depends," and only the interaction term tells you that.

5. ★ Reading the interaction graph — the key skill

Here's the trick that makes all three results pop out of one picture. Put one factor on the x-axis and draw one line per group of the other factor. Each plotted point is a cell mean. Now read it in three quick looks:

  1. Main effect of the x-axis factor? Do the lines, on average, slope up or down as you move across the x-axis? If they slope, that factor moved scores overall. To see it, picture the point halfway between the 2 dots in each column: those midpoints are the column marginal means (Vegan Study: 3.27 and 3.24, about level).
  2. Main effect of the "lines" factor? Is one line generally higher than the other? If yes, that group scored higher overall. The middle of each line is that line's marginal mean (Vegan Study: USA 3.31, UK 3.20, close together).
  3. Interaction? Are the lines non-parallel? Parallel lines = no interaction. Lines that cross or fan apart = an interaction.
⚡ Burn this in

The interaction is the only thing you read from whether the lines are parallel. Parallel → no interaction. Not parallel (crossing or fanning) → interaction. That one sentence is most of this unit. Slopes tell you about main effects; parallelness tells you about the interaction.

Here's the picture itself. On the left, the two lines cross — the effect of Factor B flips direction depending on Factor A. That non-parallelness is the interaction. On the right, for contrast, two perfectly parallel lines: there's a gap (a main effect) but the lines stay in step, so no interaction.

Mean score A₁ A₂ Factor A (x-axis) B₁ B₂ Lines cross → INTERACTION A₁ A₂ Parallel → no interaction
Each dot is a cell mean. Crossing or fanning lines signal an interaction; parallel lines do not.
Check On an interaction line graph, non-parallel lines (crossing or fanning apart) indicate…
An interaction. Non-parallel lines — whether they cross or just fan apart — mean the effect of one factor depends on the level of the other. Parallel lines are the ones that signal no interaction. Parallelness is the only thing that tells you about the interaction; slopes and heights tell you about the main effects.

6. The centerpiece — the Two-Way ANOVA calculator

Here's the grand-finale calculator, embedded right here. Paste gender (B), threat_condition (S), and math_score (T) from the class Sheet and click Sort into cells & run, or hit "Load class data (gender × threat)" and then Run. You'll get all three F tests at once — the two main effects and, the one to watch, the interaction. The worked example below walks you through exactly what you'll see.

🪟 Two-Way ANOVA (2×2)

Unit 14. Two factors at once, plus the interaction. You get all 3 F tests with p and partial η², each cell's n, M, and SD, the marginal means, the source table, and the interaction plot. Demo: math scores by gender × threat condition (the stereotype-threat study). Watch for the interaction.

Fastest: paste 3 columns straight from the class Sheet

  1. Click the letter of the row factor column (for gender, B), copy it (Ctrl+C or ⌘+C), and paste it in the left box. Its levels become the lines on the plot.
  2. Copy the column factor column (for threat_condition, S) into the middle box. Its levels go on the x-axis.
  3. Copy the score column (for math_score, T) into the right box.
  4. Click Sort into cells & run.

Columns side by side, like S and T? Select both letters, copy once, and paste in one box. The header row and blank rows are skipped. A 2×2 keeps 2 levels per factor. If a column has more, the calculator keeps the 2 largest groups and tells you what it set aside (for gender, Non-binary).

Or type or paste each cell's scores

🪟 Worked example — read a 2×2 table cold

Before the famous study, let's build the skill with clean numbers. Imagine a memory experiment crossing Factor A = study method (Massed vs. Spaced) with Factor B = test delay (Immediate vs. Delayed). The outcome is the number of words recalled. Here are the four cell means — predict each step before you reveal it.

Immediate (B₁)Delayed (B₂)
Massed (A₁)3020
Spaced (A₂)3040
🪜 Worked example — judge all three results from the four cell means
Two factors, two levels each. Compute the marginals, then call the two main effects and the interaction.
Step 1 — row marginals (Factor A) Average across each row. Massed: (30 + 20) ÷ 2 = 25. Spaced: (30 + 40) ÷ 2 = 35. These two numbers are the main effect of study method.
Step 2 — column marginals (Factor B) Average down each column. Immediate: (30 + 30) ÷ 2 = 30. Delayed: (20 + 40) ÷ 2 = 30. These two are the main effect of test delay.
Step 3 — main effect of Factor A? Row marginals are 25 vs 35 — they differ by 10. Yes, a main effect of study method: spaced practice recalls more overall.
Step 4 — main effect of Factor B? Column marginals are 30 vs 30 — identical. No main effect of delay overall… but hold that thought, because the cells tell a different story.
Step 5 — interaction? Is A's effect the same across B's levels? For Immediate, Massed→Spaced goes 30→30 (gap = 0). For Delayed, 20→40 (gap = +20). The gaps differ, so yes — an interaction. Spacing only helps on the delayed test. The flat column marginal in Step 4 hid this: an interaction can mask a main effect.
✓ You read the 2×2
Check In that memory study, the two column marginals for test delay were both 30 — yet delay clearly mattered for the spaced group. What does that tell you?
An interaction hid the effect. The delay helped one method and hurt the other by about the same amount, so the two changes canceled in the marginal average. The flat main effect doesn't mean "nothing happened" — it means "it depends," which is exactly what the interaction term catches.

🪟 The textbook interaction — stereotype threat

Now the example to remember for the exam. In a classic line of research (Spencer, Steele, & Quinn, 1999), people take a hard math test. Half are quietly reminded beforehand of a negative stereotype about their group's math ability — that's the threat condition — and half are not — the control condition. The two factors are gender (Woman, Man) — our row factor, shown as the two lines — and threat condition (Control, Threat) — our column factor, on the x-axis; the outcome is the math score.

Here are the four cell means — the average math score for each combination — from the 180 women and men in our N = 200, with the marginal means added on the edges:

ControlThreatRow marginal
Woman76.468.972.8
Man79.280.679.9
Col marginal77.674.376.0

Now picture the line graph — put condition on the x-axis (Control → Threat) and draw one line per gender:

The two lines are not parallel — they fan apart. That non-parallelness is the interaction. The effect of the threat reminder depends on gender: it hurts women's scores but leaves men's untouched. The marginals tell the "overall" story (men higher overall, 79.9 vs 72.8; a slight dip under threat overall, 77.6 vs 74.3) — but if you'd only looked at those marginals and ignored the cells, you'd badly miss the real headline.

The three results, read off the picture

Interaction: F(1, 176) = 11.13, p = .001 ✅ — the lines really do fan apart; threat's effect depends on gender, so we reject the null of no interaction. Main effect of gender (rows): F = 29.35, p < .001 — the Men's row marginal sits higher (79.9 vs 72.8). Main effect of condition (columns): F = 5.41, p = .021 — averaging the columns, scores dip a little under threat (77.6 → 74.3). The df are (1, 176): 180 women and men minus 4 cells. The interaction is the headline: this is THE graph for reading an interaction.

📏 How big? Partial eta-squared

A two-way ANOVA reports three effect sizes — one per test. The standard choice is partial η² (partial eta-squared): each effect's SS divided by that SS plus the error SS. Read it just like Unit 13's η² — the share of variance an effect accounts for, with the other effects set aside:

partial η² = SS_effect ÷ (SS_effect + SS_within)

Why not Unit 13's η²? Plain η² divides by the total sum of squares: η² = SS_effect ÷ SS_total, the share of all the spread. In a one-way, the total holds only 2 pieces, the 1 effect and the within (the noise), so η² and partial η² are the same number. In a two-way, the total also holds the other 2 effects. If 1 factor has a big effect, it swells the total, and every other effect looks smaller, even though nothing about those effects changed. Partial η² leaves the other 2 effects out and compares each effect only with the noise, as if it were the only factor in the study. That is why published two-way ANOVAs report partial η² (written ηp² or ηp²), and why we use it for every two-way effect.

Here it is in numbers, with the Vegan Study's interaction. Only the country effect changes in the "what if" column; the interaction and the noise stay the same:

Our dataWhat if country had a big effect?
SS country0.5740.00
SS country × diet4.524.52
SS within62.3262.32
SS total67.45106.88
η² = 4.52 ÷ SS total.07.04
partial η² = 4.52 ÷ (4.52 + 62.32).07.07

The interaction did not change, so its effect size should not change. Plain η² fell from .07 to .04 only because the country effect grew; partial η² stayed at .07. In our real data the main effects are tiny, so the 2 numbers agree.

For our stereotype-threat data: gender partial η² ≈ .14, condition ≈ .03, interaction ≈ .06. Common benchmarks: ~.01 small, ~.06 medium, ~.14 large. So the gender gap is a large effect, the overall threat dip is small, and the interaction — the headline — is medium: real and meaningful, but smaller than the marginal gender gap. The calculator above prints partial η² for all three effects.

✍️ Report it in APA style

A two-way ANOVA gets three APA sentences — one per test — and the interaction, when significant, leads the story. Same house rules as Units 10–13 (italicized letters, two decimals, no leading zero on p, effect sizes included):

The write-up

"A 2 × 2 ANOVA revealed a significant gender × condition interaction, F(1, 176) = 11.13, p = .001, partial η² = .06: women scored lower under threat (M = 68.9, SD = 9.4) than in the control condition (M = 76.4, SD = 9.2), whereas men's scores did not differ (threat: M = 80.6, SD = 8.7; control: M = 79.2, SD = 8.2). There were also main effects of gender, F(1, 176) = 29.35, p < .001, partial η² = .14, and condition, F(1, 176) = 5.41, p = .021, partial η² = .03."

The anatomy: interaction first (it's the finding), immediately unpacked with the cell means that show what depends on what, then the main effects in a supporting sentence. When an interaction is significant, the main effects are footnotes to the "it depends" story — the write-up's order should say so.

7. Why the graph beats the table

You could stare at the four numbers and eventually work it out. But the line graph hands you all three results in a single glance. Train your eye on the three questions, in order, and they become automatic:

What you look atWhat it tells you
Do the lines slope, on average?Main effect of the x-axis factor
Is one line higher than the other?Main effect of the "lines" factor
Are the lines parallel, or not?The interaction (parallel = none; crossing/fanning = yes)
An interaction in one sentence

An interaction means the effect of one factor DEPENDS on the other. In the picture, that dependence shows up as lines that aren't parallel — women feel the threat, men don't, so the two lines refuse to stay in step.

Check On an interaction graph, you notice that the red line sits well above the blue line at both x-positions, and the two lines are perfectly parallel. What can you conclude?
A main effect of the "lines" factor, but no interaction. One line consistently higher = a main effect of the factor drawn as lines. Parallel = no interaction. The two readings are independent: height gives a main effect, parallelness gives the interaction.

8. Reading interaction graphs: the 8 patterns (class of Dec 1)

A 2 × 2 design has only 8 possible patterns. Learn them and you can read any interaction graph cold. The classic textbook example: exercise intensity (light, heavy) on the x-axis, time of day (morning, evening) as the two lines, and hours of sleep that night as the outcome. Use the same 3 looks every time: is one line higher on average (main effect of the lines factor)? Do the lines slope on average (main effect of the x-axis factor)? Are the lines parallel (no interaction) or not (an interaction)?

#What the graph showsTime of dayIntensityInteraction
1Lines flat, close together, parallelnonono
2One line higher; both flat and parallelyesnono
3Both lines rise together, nearly on top of each othernoyesno
4One line higher, and both rise in stepyesyesno
5Lines cross in an X; the averages tienonoyes (crossover)
6Morning higher; heavy exercise helps mornings and hurts eveningsyesnoyes
7Both rise, at different rates; the line averages tienoyesyes
8Morning higher, both rise, morning rises fasteryesyesyes

Crossover or spreading (fan)? Both are interactions. Say "it depends" for a crossover and "only when" for a spreading interaction. In a crossover, the effect flips direction: our Vegan Study, where vegans score higher than omnivores in the USA (3.45 vs 3.17) and lower in the UK (3.04 vs 3.37). In a spreading interaction (also called a fan), the lines start together and spread apart: the effect is big at one level and small or zero at the other, like stereotype threat (women drop, men stay flat). The same reading works for bigger designs: a 2 × 3 has 6 cells, and an interaction shows up wherever the lines stop running in step.

Reading the two-way output. Software gives 3 F-tests, and you decide each one on its own. For the Vegan Study (50 per cell, N = 200): country F(1, 196) = 1.80, p = .182; diet F(1, 196) = 0.13, p = .719; country × diet F(1, 196) = 14.20, p < .001. Only the interaction is significant, which is what a crossover looks like. When you report it, say the interaction first, unpack it with the 4 cell means, and then give the main effects.

The graph shows the sample; the F-test says whether to trust it. Lines that are not quite parallel can still be noise. In the class data, gender × commuter on words recalled gives lines that cross, yet the interaction is F(1, 176) = 3.36, p = .068: fail to reject.

Splitting the spread: sums of squares and the source table

ANOVA splits the total spread into slices. One-way: SS total = SS between + SS within (Unit 13's diets: 292.85 = 72.13 + 220.72). Two-way: SS total = SS A + SS B + SS A × B + SS within. Each slice becomes a row of the source table: MS = SS ÷ df, and F = MS effect ÷ MS within.

SourceSSdfMSF
Country0.5710.571.80
Diet0.0410.040.13
Country × diet4.5214.5214.20
Within62.321960.32—
Total67.45199——

df within = N − the number of cells (200 − 4 = 196); df total = N − 1. Partial η² for each effect = SS effect ÷ (SS effect + SS within): country .01, diet .00, country × diet .07.

Fill in a two-way source table from the SS (Exam 4)

Exam 4 has one source-table question. You get a few SS values, the design, and the critical Fs; you fill in the rest. Call the factors A and B. Five rules do all of it:

CellRule
SS A × BSS total − SS A − SS B − SS within
dfA: k − 1 · B: k − 1 (k = the groups in that factor) · A × B: df A × df B · within: N − the number of cells · total: N − 1
MSSS ÷ df, on each row except total
FMS effect ÷ MS within, for A, B, and A × B
DecisionF bigger than F crit → reject H₀ for that effect

Check: the dfs for A, B, A × B, and within add to df total, and the SS rows add to SS total.

Worked example: exercise × time of day → sleep (3 × 4)

Exercise (light, moderate, heavy) × time of day (4 levels), 10 per cell, N = 120. Given: SS exercise = 46, SS time = 23, SS within = 360, SS total = 481.

SourceSSdfMSFF critDecision
Exercise (A)46223.006.903.08reject
Time of day (B)2337.672.302.69retain
A × B5268.672.602.18reject
Within3601083.33—
Total481119——

SS A × B = 481 − 46 − 23 − 360 = 52. df within = 120 − 12 = 108; 2 + 3 + 6 + 108 = 119 ✔. Exercise and the interaction are significant; time of day is not. Report the interaction first: the effect of exercise on sleep depends on the time of day.

Your turn: music × task (2 × 3)

Music (silence, lyrics) × task (reading, math, memory), 15 per cell, N = 90. Given: SS music = 18, SS task = 40, SS within = 336, SS total = 416. F crit(1, 84) = 3.95 · F crit(2, 84) = 3.11.

SourceSSdfMSFF critDecision
Music (A)183.95
Task (B)403.11
A × B3.11
Within336—
Total416——
Show answers
SourceSSdfMSFF critDecision
Music (A)18118.004.503.95reject
Task (B)40220.005.003.11reject
A × B22211.002.753.11retain
Within336844.00—
Total41689——
  • SS A × B = 416 − 18 − 40 − 336 = 22.
  • df within = 90 − 6 = 84; 1 + 2 + 2 + 84 = 89 ✔.
  • Both main effects are significant; the interaction is not (2.75 < 3.11). Music does about the same thing on every task.

Assumptions (one-way and two-way)

The same 3 as the one-way ANOVA: independent groups (different people in each cell), scores roughly normal in each cell (or 30 or more per cell), and similar spreads (SDs) in every cell. The Vegan Study passes all 3: 200 different people, 50 per cell, SDs from .52 to .59. Equal cell sizes help, because ANOVA then holds up well when a cell is a little off.

💻 In Google Sheets

Sheets has no one-click two-way ANOVA, so we do the part that matters: the four cell means and the interaction graph. Use =AVERAGEIFS, which says "average the score column, but only the rows where gender matches and condition matches":

=AVERAGEIFS(score, gender, "Woman", cond, "Control")  → 76.4
=AVERAGEIFS(score, gender, "Woman", cond, "Threat")   → 68.9
=AVERAGEIFS(score, gender, "Man",   cond, "Control")  → 79.2
=AVERAGEIFS(score, gender, "Man",   cond, "Threat")   → 80.6

For the marginal means, drop one condition and average by gender alone (and vice versa):

=AVERAGEIF(gender, "Woman", score)   → 72.8   (Woman row marginal)
=AVERAGEIF(cond,   "Threat", score)  → 74.8   (all 200 students; the 180 women and men alone give 74.3)

Lay the four cell means in a little 2×2 table, then Insert ▸ Chart ▸ Line chart with condition on the x-axis and one line per gender. That picture is your interaction graph — you'll watch the Women's line dive while the Men's line holds flat. Read the two main effects and the interaction right off it. The three F-values come from the provided template (or this page's calculator above).

⚠️ Watch out for

Parallel = no interaction. Don't overthink it — the interaction lives in the parallelness of the lines, nothing else. An interaction can hide a main effect, and that's fine — if two opposite slopes cancel, the overall average looks flat even though "it depends" is the real story. Lines crossing OR fanning apart both count as an interaction. Decide each of the three tests with p ≤ .05, and say "fail to reject" — never "accept" — when a test comes up non-significant. And the headline of an interaction is always "it depends," never a flat one-size-fits-all claim.

Key terms

Two-way ANOVAFactor2×2 designLevelMain effectInteraction Cell meanMarginal meanGrand meanCrossover interactionParallel linesLine graphStereotype threat
🎓 You made it

That's the course. You started by squeezing 200 numbers into one average. You're finishing by reading two factors and their teamwork off a single line. The whole point of a two-way ANOVA is that one skill — spotting the interaction — so keep practicing reading those graphs until it's automatic. Well done.

Still hungry? There's one tool this course never needed but published research uses constantly: the test for categories and counts. Bonus Unit 15 — Chi-Square Tests is short, won't appear on Exam 4, and rounds out your toolkit.

Interactive · the whole skill

Train your eye — read the graph

A line graph appears; you call the main effect of the ROW variable (the lines), the COLUMN variable (the x-axis), and the interaction. It cycles through all 8 possible patterns — and "Show all 8 patterns" lays out the entire cheat-sheet at once.

Practice — never graded

Check yourself

Ten quick true/false items with instant explanations. The finale — real practice, never graded.

Sigma says: When you see a two-way line graph, ask the three questions in order — do the lines slope, is one higher, are they parallel? The first two are main effects; the last one is the interaction. Parallel means no interaction. That's the whole unit in your pocket.