Written and maintained by CASRAI Editorial Board
Published
On this page
Factorial analysis of variance (factorial ANOVA) tests how a continuous outcome differs across the groups defined by two or more categorical factors at once. It answers three questions in one analysis: does the first factor matter, does the second factor matter, and does the effect of one factor depend on the level of the other (the interaction). This guide defines the method, shows the arithmetic on a small hand-computed 2 × 2 example, and gives reporting wording and code.
What is factorial analysis of variance?
A factorial ANOVA is the tool for analysing a continuous outcome using two or more grouping variables (Navarro and Foxcroft, Learning Statistics with jamovi, ch. 14). Each grouping variable is a factor, its categories are its levels, and every combination of levels is a cell. A 2 × 2 design has 4 cells and a 2 × 3 design has 6 (Furtado, Statistics for Movement Science, ch. 16). The general method of partitioning variance is covered in the analysis of variance guide; this page concentrates on what is specific to several factors.
Factorial ANOVA vs two-way ANOVA
Two-way ANOVA is the factorial ANOVA with exactly two grouping variables; designs with three or more factors (three-way and above) are also factorial ANOVAs. The NIST/SEMATECH e-Handbook describes the two-way case as testing three null hypotheses: no difference across the levels of factor A, no difference across the levels of factor B, and no interaction between A and B. The one-way vs two-way ANOVA comparison sets the simpler case beside this one.
Main effects and the interaction
A main effect is the effect of one factor averaged over the levels of the other. The interaction means the effect of one factor depends on the level of the other factor (Furtado, ch. 16). Because of that, the interaction is checked first: if it is significant, the main effects are not interpreted in isolation.
Formula: how the variance is partitioned
For a balanced design with factor A having a levels, factor B having b levels and n observations per cell (total N = abn), the total variation splits into four parts (Furtado, ch. 16):
SStotal = SSA + SSB + SSA×B + SSerror
- Degrees of freedom: dfA = a − 1; dfB = b − 1; dfA×B = (a − 1)(b − 1); dferror = N − ab.
- Test statistic: F = MSeffect / MSerror, where each MS is the sum of squares divided by its degrees of freedom.
- Effect estimates from marginal means (Navarro and Foxcroft): the effect of row level r is αr = Ȳr. − Ȳ..; of column level c is βc = Ȳ.c − Ȳ..; and the interaction in cell rc is (αβ)rc = Ȳrc − Ȳr. − Ȳ.c + Ȳ... Here Ȳrc is a cell mean, Ȳr. a row mean, Ȳ.c a column mean and Ȳ.. the grand mean.
- Sums of squares for the effects are n times the sum of the squared effect estimates over the cells they apply to: SSA = nb Σαr², SSB = na Σβc², SSA×B = n ΣΣ(αβ)rc². SSerror is the sum of squared deviations of each observation from its own cell mean.
The data table below the article shows how the degrees of freedom grow for common designs.
Worked example with real numbers
The data below are invented for illustration and do not come from a real study. Suppose 20 learners are randomly assigned to one of four conditions formed by crossing two factors: format (Lecture, Active) and practice schedule (Massed, Spaced), with n = 5 per cell. The outcome is a test score.
| Cell | Scores | Cell mean |
|---|---|---|
| Lecture, Massed | 62, 65, 68, 64, 66 | 65.0 |
| Lecture, Spaced | 70, 72, 69, 74, 70 | 71.0 |
| Active, Massed | 66, 68, 70, 67, 69 | 68.0 |
| Active, Spaced | 82, 85, 80, 84, 84 | 83.0 |
Step 1: marginal means and effect estimates
Row means: Lecture = (65 + 71) / 2 = 68.0 and Active = (68 + 83) / 2 = 75.5. Column means: Massed = (65 + 68) / 2 = 66.5 and Spaced = (71 + 83) / 2 = 77.0. Grand mean = 71.75. The effect estimates are α(Lecture) = −3.75, α(Active) = +3.75, β(Massed) = −5.25 and β(Spaced) = +5.25. The interaction estimate for Lecture–Massed is 65 − 68 − 66.5 + 71.75 = +2.25; it is +2.25 for Active–Spaced and −2.25 for the other two cells.
Step 2: sums of squares
- SSformat = 5 × 2 × (3.75² + 3.75²) = 10 × 28.125 = 281.25
- SSpractice = 5 × 2 × (5.25² + 5.25²) = 10 × 55.125 = 551.25
- SSformat×practice = 5 × (4 × 2.25²) = 5 × 20.25 = 101.25
- SSerror: squared deviations from each cell mean sum to 20 (Lecture–Massed), 16 (Lecture–Spaced), 10 (Active–Massed) and 16 (Active–Spaced), giving 62.00
- Check: 281.25 + 551.25 + 101.25 + 62.00 = 995.75, which equals the total sum of squares computed directly around the grand mean.
Step 3: the ANOVA table
Here dferror = 20 − 4 = 16, so MSerror = 62 / 16 = 3.875.
| Source | SS | df | MS | F | Partial η² |
|---|---|---|---|---|---|
| Format | 281.25 | 1 | 281.25 | 72.58 | .82 |
| Practice | 551.25 | 1 | 551.25 | 142.26 | .90 |
| Format × Practice | 101.25 | 1 | 101.25 | 26.13 | .62 |
| Error | 62.00 | 16 | 3.875 |
Partial η² is SSeffect / (SSeffect + SSerror), for example 101.25 / (101.25 + 62) = .62 (Furtado, ch. 16). The p-values, computed with software, are about 2.4 × 10⁻⁷ for format, 2.2 × 10⁻⁹ for practice and 1.0 × 10⁻⁴ for the interaction, so all three are below .001. The eta-squared vs partial eta-squared comparison explains why the two measures differ in multi-factor designs.
Interpretation: reading the result
Look at the interaction line first. Here it is significant, so the statement “spaced practice helps by 10.5 points on average (77.0 − 66.5)” hides a difference between formats: spacing adds 6 points under Lecture (65.0 to 71.0) but 15 points under Active (68.0 to 83.0). On an interaction plot the two lines both rise but are not parallel. That pattern, the same direction with different size, is an ordinal interaction.
| What you see | How to read it (Furtado, ch. 16) |
|---|---|
| Interaction not significant | Interpret the main effects; lines on the interaction plot are roughly parallel. |
| Interaction significant, ordinal | Effect has the same direction at every level but differs in size; main effects are not interpreted in isolation. |
| Interaction significant, disordinal | Effect reverses direction across levels; lines cross. |
| Partial η² benchmarks | Cohen (1988): about .01 small, .06 medium, .14 large. |
As a contrast, in the jamovi textbook’s drug-by-therapy example the interaction was not significant, F(2, 12) = 2.5, p = .125, while both main effects were (drug F(2, 12) = 31.7, p < .001; therapy F(1, 12) = 8.6, p = .013), so the main effects could be read directly.
Simple effects after a significant interaction
Simple effects test one factor at each level of the other, and are run only after a significant interaction, using the original model’s error term (Furtado, ch. 16). In the example, the effect of practice schedule within Lecture has SS = 5 × (6²) / 2 = 90, F(1, 16) = 90 / 3.875 = 23.23. Within Active it is SS = 5 × (15²) / 2 = 562.5, F(1, 16) = 145.16. The two simple-effect sums of squares add to 652.5, which equals SSpractice + SSformat×practice (551.25 + 101.25). See simple effects analysis for the full procedure. For pairwise cell comparisons, R’s TukeyHSD is the usual route, with the caveat in its documentation that its intervals apply exactly only to balanced designs (Tukey HSD test).
Assumptions and common mistakes
- Normality and equal variances. The between-subjects tests assume normally distributed populations and homogeneity of variance (NIST/SEMATECH; Furtado). See assumptions of two-way ANOVA.
- Sphericity for within-subjects factors. A repeated factor with three or more levels also needs sphericity, checked with Mauchly’s test; Furtado applies the Greenhouse–Geisser correction when ε < .75 and Huynh–Feldt otherwise.
- Reading main effects past a significant interaction. The most common error; check the interaction first.
- Running simple effects with their own error terms. Use the original model’s error term, as above.
- Ignoring the sums-of-squares type in unbalanced data. With equal cell sizes the order does not matter, as the identical Type II and Type III output for the example below confirms; with unequal cells, report which type you used. SPSS defaults to Type III (Furtado).
How to report factorial ANOVA results (APA-style example)
Report each effect with its degrees of freedom, F, p and an effect size, following the pattern used in the textbook sources above. For the worked example:
“A 2 (format) × 2 (practice schedule) between-subjects ANOVA showed a significant main effect of format, F(1, 16) = 72.58, p < .001, ηp² = .82, a significant main effect of practice schedule, F(1, 16) = 142.26, p < .001, ηp² = .90, and a significant format × practice interaction, F(1, 16) = 26.13, p < .001, ηp² = .62. Simple effects showed that spaced practice raised scores under both formats, with the larger gain under active learning.”
How to calculate it in Excel, R or Python
Python (statsmodels)
This snippet was run on the example data and reproduces the table above.
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols
scores = {("Lecture", "Massed"): [62, 65, 68, 64, 66],
("Lecture", "Spaced"): [70, 72, 69, 74, 70],
("Active", "Massed"): [66, 68, 70, 67, 69],
("Active", "Spaced"): [82, 85, 80, 84, 84]}
rows = [(f, s, x) for (f, s), v in scores.items() for x in v]
df = pd.DataFrame(rows, columns=["format", "practice", "score"])
model = ols("score ~ C(format) * C(practice)", data=df).fit()
print(sm.stats.anova_lm(model, typ=2))
R
d = data.frame(
format = rep(c("Lecture", "Active"), each = 10),
practice = rep(rep(c("Massed", "Spaced"), each = 5), 2),
score = c(62,65,68,64,66, 70,72,69,74,70, 66,68,70,67,69, 82,85,80,84,84))
summary(aov(score ~ format * practice, data = d))
The formula format * practice fits both main effects and their interaction; TukeyHSD() accepts the fitted aov object.
Excel
With the Analysis ToolPak enabled, use the Data tab, Data Analysis, “Anova: Two-Factor With Replication”. Put the levels of one factor in the first column and the levels of the other in the first row, enter the labelled range as Input Range, and set “Rows per sample” to the number of observations per cell (5 here). In the output, the row labelled “Sample” tests the row factor and “Columns” tests the column factor; the interaction and within-group rows give the interaction test and the error term. The tool needs equal numbers of observations per cell.
Frequently asked questions
What is the difference between factorial ANOVA and two-way ANOVA?
Two-way ANOVA is a factorial ANOVA with exactly two factors. “Factorial” is the broader name and also covers three-way and larger designs.
How many hypotheses does a two-factor ANOVA test?
Three: no difference across the levels of factor A, none across the levels of factor B, and no A × B interaction (NIST/SEMATECH e-Handbook).
What do I do if the interaction is significant?
Do not interpret the main effects in isolation. Inspect an interaction plot and test simple effects, one factor at each level of the other, using the original model’s error term.
How do I calculate the degrees of freedom?
dfA = a − 1, dfB = b − 1, dfA×B = (a − 1)(b − 1) and dferror = N − ab; in the example, 1, 1, 1 and 16.
Which effect size should I report?
Partial η² is SSeffect / (SSeffect + SSerror); Furtado also gives partial ω² and Cohen’s f = √(η²p / (1 − η²p)).
Sources
- Navarro, D. and Foxcroft, D., Learning Statistics with jamovi, chapter 14, Factorial ANOVA: lsj.readthedocs.io/en/latest/Ch14/Ch14_ANOVA2/ (read 2026-11-14).
- Furtado, O., Statistics for Movement Science, chapter 16, Factorial ANOVA: drfurtado.github.io/sms/ch16-factorial-anova.html (read 2026-11-14).
- NIST/SEMATECH e-Handbook of Statistical Methods, two-way ANOVA: itl.nist.gov/div898/handbook/prc/section4/prc43.htm (read 2026-11-14).
- R Documentation,
TukeyHSD(stats package): stat.ethz.ch/R-manual/R-devel/library/stats/html/TukeyHSD.html (read 2026-11-14). - Stat Trek, two-factor ANOVA with Excel (ToolPak layout): stattrek.com/anova/full-factorial/two-factor-excel (read 2026-11-14).
Data: Degrees of freedom in balanced factorial ANOVA designs (n = 10 per cell)
Cells, degrees of freedom for each effect and error degrees of freedom for three common balanced between-subjects factorial designs, computed from the degrees-of-freedom formulas in a factorial ANOVA textbook chapter with n = 10 observations per cell.
| Design | Cells | Total N | df factor A | df factor B | df interaction | df error |
|---|---|---|---|---|---|---|
| 2 x 2 | 4 | 40 | 1 | 1 | 1 | 36 |
| 2 x 3 | 6 | 60 | 1 | 2 | 2 | 54 |
| 3 x 3 | 9 | 90 | 2 | 2 | 4 | 81 |
Sources
- Furtado, Statistics for Movement Science, ch. 16 Factorial ANOVA (accessed 2026-11-14)
Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.







