Skip to main content

16

Noise and evidence
Principle or heuristic
Intermediate
You need this much more of a sample size to estimate an interaction that is half the size of a main effect.
Published

November 9, 2026

Modified

November 13, 2026

Entry #80 in Andrew Gelman’s Handy Statistical Lexicon. Original discussion: You need 16 times the sample size to estimate an interaction than to estimate a main effect.

Filed under Noise and evidence · Principle or heuristic · Intermediate.

Related terms: interaction effect, effect modification, subgroup analysis, power for interactions.

Source check: ✓ The explanation was checked against the source.

What it is

Interactions are much harder to estimate than main effects. In a balanced design, the standard error of an interaction is twice the standard error of the main effect. Realistic interactions are also usually smaller than main effects, say half the size. Together these mean you need \(2^2 \times 2^2 = 16\) times the sample size to estimate the interaction with the same precision relative to its size.

Why it matters

Studies are powered for main effects and then mined for interactions: the treatment worked especially for women, the effect was stronger among older participants. If the study had 80% power for the main effect, its power for a half-size interaction is tiny. Interaction “findings” from such studies are mostly the significance filter at work: exaggerated, unstable and often wrong in sign.

How it works

In a 2×2 design with \(n\) people per cell and outcome sd \(\sigma\):

  • the main effect (average over the other factor) is a difference of two means, each based on \(2n\) people, so \(\text{se}_{\text{main}} = \sigma\sqrt{1/(2n) + 1/(2n)} = \sigma/\sqrt{n}\);
  • the interaction is a difference of differences of four cell means, so \(\text{se}_{\text{int}} = \sigma\sqrt{4/n} = 2\sigma/\sqrt{n}\).

If the interaction is half the main effect, its z-score is \((\theta/2)/(2\sigma/\sqrt{n}) = \tfrac14\) of the main effect’s. Matching precision requires \(n\) to be \(4^2 = 16\) times larger.

Simulated example

A 2×2 experiment with main effect θ and an interaction of θ/2. For a range of sample sizes, estimate the power to detect each.

Show simulation code

The R version uses base R, and the Python version uses NumPy and Matplotlib. Where the simulation draws random numbers, each language draws its own, so exact numbers differ slightly but show the same pattern. The numbered markers in the R code are explained under it.

import {rng, range, mean, qnorm, fmt, debounce} from "../js/stats.js"

viewof theta = debounce(Inputs.range([0.1, 1], {value: 0.4, step: 0.05, label: "Main effect θ (in sd units)"}))
viewof intRatio = debounce(Inputs.range([0.25, 1], {value: 0.5, step: 0.05, label: "Interaction as a fraction of the main effect"}))
viewof seed = debounce(Inputs.range([1, 500], {value: 80, step: 1, label: "Random seed"}))

power16 = {
  const r = rng(seed);
  const ns = [10, 20, 40, 80, 160, 320, 640, 1280];
  const gamma = intRatio * theta;
  return ns.flatMap(n => {
    let hitM = 0, hitI = 0;
    for (let rep = 0; rep < 400; rep++) {
      // Cells: (treat a, group b), coded ±1/2. The main effect of a is theta,
      // and the interaction (difference of differences) is gamma.
      const cell = (a, b) => mean(r.normals(n, theta * (a - 0.5) + gamma * (a - 0.5) * (b - 0.5), 1));
      const m00 = cell(0, 0), m10 = cell(1, 0), m01 = cell(0, 1), m11 = cell(1, 1);
      const main = ((m10 - m00) + (m11 - m01)) / 2, inter = (m11 - m01) - (m10 - m00);
      if (Math.abs(main / (1 / Math.sqrt(n))) > 1.96) hitM++;
      if (Math.abs(inter / (2 / Math.sqrt(n))) > 1.96) hitI++;
    }
    return [{n, what: "Main effect", power: hitM / 400}, {n, what: "Interaction", power: hitI / 400}];
  });
}

Plot.plot({
  ariaLabel: "16: simulation chart",
  ariaDescription: "Horizontal axis: People per cell (log scale). Vertical axis: Power. The chart updates with the controls above it, and the summary below the charts states the result in words.",
  height: 300,
  x: {type: "log", label: "People per cell (log scale)", grid: true},
  y: {label: "Power", domain: [0, 1], tickFormat: "%", grid: true},
  color: {legend: true, range: ["#d6604d", "#2166ac"]},
  marks: [Plot.line(power16, {x: "n", y: "power", stroke: "what", strokeWidth: 2, marker: "circle"}), Plot.ruleY([0.8], {stroke: "#8a8a8a", strokeDasharray: "4 3"})]
})
# 16: you need 16 times the sample size to estimate an interaction.
1theta <- 0.4 # main effect (in sd units)
int_ratio <- 0.5 # interaction as a fraction of the main effect
2set.seed(80)

ns <- c(10, 20, 40, 80, 160, 320, 640, 1280) # people per cell
3gamma <- int_ratio * theta
power <- sapply(ns, function(n) {
  hits <- replicate(400, {
    # Cells (treatment a, group b); main effect theta, interaction gamma
4    cell <- function(a, b) {
      mean(rnorm(n, theta * (a - 0.5) +
        gamma * (a - 0.5) * (b - 0.5), 1))
    }
    m00 <- cell(0, 0)
    m10 <- cell(1, 0)
    m01 <- cell(0, 1)
    m11 <- cell(1, 1)
5    main <- ((m10 - m00) + (m11 - m01)) / 2
6    inter <- (m11 - m01) - (m10 - m00)
    c(main = abs(main * sqrt(n)) > 1.96, inter = abs(inter * sqrt(n) / 2) >
      1.96)
  })
  rowMeans(hits)
})
7z <- qnorm(0.975) + qnorm(0.8)
cat("People per cell for 80% power: main effect ", ceiling(z^2 / theta^2),
  ", interaction ", ceiling(z^2 * 4 / gamma^2), "\n",
  sep = ""
)

8matplot(ns, t(power),
  type = "b", pch = 19, lty = 1, log = "x",
  col = c("#2166ac", "#d6604d"), ylim = c(0, 1),
  xlab = "People per cell", ylab = "Power"
)
abline(h = 0.8, lty = 2)
legend("topleft", c("Main effect", "Interaction"),
  col = c("#2166ac", "#d6604d"), pch = 19, bty = "n"
)
1
The page’s controls: the main effect and the interaction as a fraction of it.
2
Fixes the random numbers so the run is reproducible.
3
The interaction: half the main effect by default.
4
A cell mean of a 2 by 2 design with n people per cell, coded plus or minus one half, so the interaction is the difference of differences.
5
The main effect estimate, with standard error 1 over the square root of n.
6
The interaction estimate, with twice that standard error.
7
The analytic answer: half the effect with twice the standard error is a quarter of the z-score, so 16 times the sample.
8
Power against people per cell for both. The interaction’s curve is the main effect’s shifted 16-fold to the right.
# 16: you need 16 times the sample size to estimate an interaction.
from statistics import NormalDist
import numpy as np
import matplotlib.pyplot as plt

theta = 0.4      # main effect (in sd units)
int_ratio = 0.5  # interaction as a fraction of the main effect
rng = np.random.default_rng(80)

ns = [10, 20, 40, 80, 160, 320, 640, 1280]  # people per cell
gamma = int_ratio * theta
p_main, p_inter = [], []
for n in ns:
    # Cells (treatment a, group b); main effect theta, interaction gamma.
    # A cell mean of n draws is normal with sd 1 / sqrt(n).
    def cell(a, b):
        mu = theta * (a - 0.5) + gamma * (a - 0.5) * (b - 0.5)
        return rng.normal(mu, 1 / np.sqrt(n), 400)
    m00, m10, m01, m11 = cell(0, 0), cell(1, 0), cell(0, 1), cell(1, 1)
    main = ((m10 - m00) + (m11 - m01)) / 2
    inter = (m11 - m01) - (m10 - m00)
    p_main.append(np.mean(np.abs(main * np.sqrt(n)) > 1.96))
    p_inter.append(np.mean(np.abs(inter * np.sqrt(n) / 2) > 1.96))
q = NormalDist().inv_cdf
z = q(0.975) + q(0.8)
print(f"People per cell for 80% power: main effect "
      f"{np.ceil(z ** 2 / theta ** 2):.0f}, interaction "
      f"{np.ceil(z ** 2 * 4 / gamma ** 2):.0f}")

plt.semilogx(ns, p_main, "o-", color="#2166ac", label="Main effect")
plt.semilogx(ns, p_inter, "o-", color="#d6604d", label="Interaction")
plt.axhline(0.8, color="black", linestyle="--")
plt.ylim(0, 1)
plt.xlabel("People per cell")
plt.ylabel("Power")
plt.legend()
plt.show()

Try it in R. This simulation is also written in R. You can edit it and run it in your browser with webR, with nothing to install.

Key takeaways

  • Interaction estimates have twice the standard error of main effects in balanced designs.
  • Realistic interactions are smaller than main effects, so power drops by a factor of about 16 in sample size.
  • Treat interaction “findings” from studies powered for main effects with great suspicion.

Source

Back to top