Factorial Repeated-Measures ANOVA

Info sheet · Statistics for Psychology & Neuroscience

Author

Andrew Bell

Published

August 13, 2026

Info sheet 0.2 (draft) · Prerequisites: one-way repeated-measures ANOVA; factorial ANOVA & interactions · Give feedback ↗

Working notes for the author — not shown to students once collapsed; remove before publishing.

  • [ ]

What you’ll get from this sheet

So far we’ve only met repeated-measures designs with a single independent variable. But just like between-subjects designs, a repeated-measures study can have more than one IV — a factorial repeated-measures design. By the end you should be able to:

  1. Describe, conceptually, how the total sum of squares is partitioned here.
  2. Say what hypotheses this design tests.
  3. Run a factorial repeated-measures ANOVA in R (and Python).

In a repeated-measures factorial ANOVA it’s the within-subjects variance that gets partitioned — into Factor A, Factor B, their interaction, and a residual. Individual differences are pulled out into a subject term, which shrinks the error and makes the test more powerful.

The Oreo example

To make it concrete, return to our (fake but realistic) Oreo taste-test. Previously we looked only at cookie type (8 varieties). Now we add a second factor: milk dipping (dipped vs not). Each of our 20 participants tastes all 16 cookies — 8 types, each with and without milk. Three questions follow:

  • Do people rate different cookie types differently? (main effect of cookie type)
  • Does dipping in milk change ratings? (main effect of milk)
  • Does dipping matter more for some cookie types than others? (interaction)

That’s a two-way repeated-measures ANOVA, with rating (0–10) as the DV.

Partitioning the variability

Here’s the key contrast with a between-subjects design. In both, total variability splits into between-subjects and within-subjects. But:

  • In an independent factorial ANOVA, we work with the between-subjects part and split the model variability into Factor A, Factor B, and A × B — leaving all the within-subjects noise in the residual.
  • In a repeated-measures factorial ANOVA, we set aside the between-subjects part (that’s the individual differences) and partition the within-subjects variability into Factor A, Factor B, the interaction, and a residual.

That’s the whole trick: pulling individual differences out into their own term means they never land in the error against which effects are tested — which is why repeated-measures designs are so much more powerful.

Why pairing pays: watch the error term

Below, each line is one participant, rated without milk (left) and with milk (right). The milk effect and the noise are fixed. Drag how different people are from each other overall and watch the two F-tests for the milk effect: one that ignores the pairing (between-subjects) and one that uses it (repeated-measures).

The lines stay roughly parallel — everyone gets a similar bump from milk — but as you raise the individual differences the whole bundle spreads vertically. The between-subjects test drowns: that vertical spread is individual differences, and it’s been dumped straight into its error term, so its F collapses. The repeated-measures test barely flinches, because it looks only at each person’s own change from left to right — the baseline differences are siphoned off into the subject term. Same effect, same noise, wildly different power. Now imagine that same benefit applied to two within-subjects factors and their interaction: that’s the factorial repeated-measures ANOVA.

Running the analysis

The syntax is nearly identical to the one-way version — you just hand it a vector of factors for the within-subjects part. The interaction term is added automatically.

# The tidy way — automatically Type III, with effect sizes:
library(rstatix)
anova_test(
  data   = OreoRatingsFactorial,
  dv     = rating,
  wid    = participant,
  within = c(cookie_type, milk)
)
# ezANOVA() (ez) and aov_ez() (afex) do the same job.

The aov() and Python tabs run live; rstatix/ez/afex are the tools you’d reach for in a real analysis.

Why does the repeated-measures F stay high even when participants differ a lot from one another overall?

Because a repeated-measures ANOVA pulls each person’s overall level out into a subject term, so individual differences never enter the error the effect is tested against. It compares each participant to themselves across conditions. A between-subjects test can’t do that — those baseline differences land in its residual and inflate the error, shrinking F.

More within-subjects levels bring sphericity back into play: for any factor with more than two levels, check Mauchly’s test and apply a Greenhouse–Geisser / Huynh–Feldt correction if it’s violated (see the Sphericity sheet). Also watch missing data — most functions drop a participant entirely if any of their cells is missing, quietly costing you power.

Where this shows up next

See the Repeated-Measures ANOVA and Sphericity & Mauchly’s Test sheets for the one-factor case and the correction machinery, and Chapter (Repeated Measures) for the full partitioning and worked Oreo analysis.