Mixed ANOVAs

Info sheet · Statistics for Psychology & Neuroscience

Author

Andrew Bell

Published

August 13, 2026

Info sheet 0.2 (draft) · Prerequisites: 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

The design that mixes the two worlds. By the end you should be able to:

  1. Describe how the total sum of squares is partitioned in a mixed ANOVA.
  2. Run a mixed ANOVA in R.

A mixed ANOVA has at least one between-subjects factor and one within-subjects factor. It uses two error terms — a between-subjects error for the between factor, and a within-subjects error for the within factor and the interaction.

Where we’ve been

We’ve covered two “pure” designs. An independent (between-subjects) ANOVA has all factors between-subjects — each group of participants experiences only one condition. A repeated-measures (within-subjects) ANOVA has all factors within-subjects — each participant experiences every condition. Group A does Task 1 while Group B does Task 2 (independent); or everyone does both tasks (repeated measures).

So what if you want one factor that’s between-subjects and another that’s within? That’s the mixed ANOVA. (Quick note: a mixed ANOVA is not the same as a mixed-effects model — statisticians are picky here, myself included. We’ll keep the term mixed ANOVA.) Like the other classic designs it’s a bit “old school” next to mixed-effects models, but it’s still widely taught and used.

Which design is this? Set each factor

Every classic ANOVA is just a choice of between or within for each factor. Flip the two switches and watch the design — and its error structure — change.

Set one factor to between and one to within and you land on the mixed ANOVA — and the table shows its signature: the between factor is tested against a between-subjects error (participants nested within groups), while the within factor and the interaction are tested against a within-subjects error. Two error terms in one model. Set both the same way and you’re back in territory you already know.

Partitioning the variance

In an independent ANOVA, total variance splits into between-subjects (where the action is — differences between groups) and within-subjects (just residual noise). In a repeated-measures ANOVA it’s the reverse — the within-subjects part carries the effects, and the between-subjects part is treated as individual differences. A mixed ANOVA cares about both: the between factor lives in the between-subjects part, the within factor and the interaction live in the within-subjects part. By definition a mixed ANOVA must be factorial — at least two factors, at least one of each kind.

The Oreo mixed design

Last time, participants tasted all 16 cookies (8 types × dipped/not). Realistically, not everyone wants to eat 16 Oreos in a sitting — so instead: Group 1 (20 people) tastes all 8 types with milk; Group 2 (20 people) tastes all 8 types without. Now milk is between-subjects (you’re in one group or the other) and cookie type is within-subjects (everyone rates all 8). Same three questions as before — main effect of cookie type, main effect of milk, and their interaction — but a mixed design. (When you plot it, facet the two milk groups side by side: they’re different people, and the layout should say so.)

Running it in R

Almost identical to the factorial repeated-measures syntax, with one tweak: split the factors — one goes in within, the other in between.

library(rstatix)
anova_test(
  data    = OreoRatingsMixed,
  dv      = rating,
  wid     = participant,
  within  = cookie_type,   # within-subjects factor
  between = milk           # between-subjects factor
)
# two main effects + interaction, with df, F, p, effect sizes
library(afex)
aov_ez(
  id       = "participant",
  dv       = "rating",
  data     = OreoRatingsMixed,
  within   = "cookie_type",
  between  = "milk",
  detailed = TRUE
)
# df may look unusual — that's the sphericity correction (next sheet)
import pingouin as pg           # not available in the live runtime
pg.mixed_anova(data=oreo, dv="rating",
               within="cookie_type", subject="participant", between="milk")

The aov() tab runs live; rstatix/afex/pingouin are the tools you’d use in a real analysis.

At this point you’ve now seen every “classic” ANOVA design — one-way independent, factorial independent, one-way repeated-measures, factorial repeated-measures, and mixed — and how to run each in R.

Group 1 tastes all cookie types with milk; Group 2 tastes all types without. Which factor is between-subjects and which is within — and what design is this?

Cookie type is within-subjects (every participant rates all types). Milk is between-subjects (each participant is in only one milk group). One of each makes it a mixed ANOVA — so cookie type and the interaction are tested against a within-subjects error, and milk against a between-subjects error.

A mixed ANOVA has to satisfy both families of assumptions: homogeneity of variance across the between-subjects groups (Levene’s test), and sphericity for the within-subjects factor once it has 3+ levels (Mauchly’s test, with a Greenhouse–Geisser / Huynh–Feldt correction if violated). And remember — a mixed ANOVA is only a very basic cousin of a true mixed-effects model; it’s a stepping stone, not the full picture.

Where this shows up next

See Chapter (Repeated Measures) for the worked Oreo mixed analysis, and the next sheet for the assumptions — especially sphericity — you must check before reporting.