Skip to main content

Multiple Comparisons

Noise and evidence
Principle or heuristic
Intermediate
Generally not an issue if you’re doing things right but can be a big problem if you sloppily model hierarchical structures non-hierarchically.
Published

November 9, 2026

Modified

November 13, 2026

Entry #25 in Andrew Gelman’s Handy Statistical Lexicon. Original discussion: Multiple comparisons: my talk at the London School of Economics on Monday.

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

Related terms: partial pooling, shrinkage, Bonferroni correction, false discovery rate, hierarchical model.

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

What it is

The classical multiple-comparisons problem says that if you test many effects, some will look “significant” by chance, so you should widen intervals with a correction such as Bonferroni. Gelman’s point is that the problem comes mostly from analyzing a structured set of effects as if they were unrelated. Fit a multilevel model that treats the effects as draws from a common distribution, and the estimates shrink toward each other in proportion to the noise. The spurious “discoveries” mostly disappear without any correction.

Why it matters

Corrections such as Bonferroni hold the interval centers fixed and only stretch the widths. That keeps the noisy, exaggerated point estimates and pays for safety with lost power. Partial pooling fixes the centers instead. When true effects are similar, the model learns that and shrinks hard. When they really differ, it shrinks little. This gives good error rates and sensible estimates. It is the approach in Gelman, Hill and Yajima’s “Why we (usually) don’t have to worry about multiple comparisons.”

How it works

For \(J\) group effects \(\theta_j\) with estimates \(y_j \sim \mathrm{N}(\theta_j, \sigma^2)\):

  • No pooling: claim an effect when \(|y_j| > 1.96\sigma\).
  • Multilevel: with \(\theta_j \sim \mathrm{N}(\mu, \tau^2)\), the posterior mean is \(\mu + \frac{\tau^2}{\tau^2 + \sigma^2}(y_j - \mu)\), with a correspondingly smaller sd. Claim an effect when the posterior interval excludes zero.

When \(\tau\) is small relative to \(\sigma\), the shrinkage factor is near 0. Estimates collapse toward the mean and few claims survive, which is the right answer when there is little to find.

Simulated example

Here 50 group effects are estimated with noise. Set the spread of true effects to 0 for a world of pure noise, then increase it. Count the confident claims of the wrong sign made by each approach.

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} from "../js/stats.js"

viewof tau = Inputs.range([0, 1], {value: 0.1, step: 0.05, label: "Spread of true effects τ"})
viewof sigma = Inputs.range([0.2, 1], {value: 0.5, step: 0.05, label: "Standard error of each estimate"})
viewof seed = Inputs.range([1, 500], {value: 25, step: 1, label: "Random seed"})

mc = {
  const r = rng(seed);
  const raw = range(50).map(j => { const theta = r.normal(0, tau); return {j, theta, y: r.normal(theta, sigma)}; });
  const mu = mean(raw.map(d => d.y));
  const tau2 = Math.max(0, mean(raw.map(d => (d.y - mu) ** 2)) - sigma * sigma);
  const B = tau2 / (tau2 + sigma * sigma);
  return raw.map(d => {
    const pm = mu + B * (d.y - mu), psd = Math.sqrt(B) * sigma + 1e-9;
    return {...d, pm, psd,
      claimClassic: Math.abs(d.y) > 1.96 * sigma,
      claimML: Math.abs(pm) > 1.96 * psd && B > 0,
      wrongClassic: Math.abs(d.y) > 1.96 * sigma && Math.sign(d.y) !== Math.sign(d.theta),
      wrongML: B > 0 && Math.abs(pm) > 1.96 * psd && Math.sign(pm) !== Math.sign(d.theta)};
  });
}

Plot.plot({
  ariaLabel: "Multiple Comparisons: simulation chart",
  ariaDescription: "Horizontal axis: Group (sorted by raw estimate). Vertical axis: Estimate ± 1.96 se. The chart updates with the controls above it, and the summary below the charts states the result in words.",
  height: 340,
  x: {label: "Group (sorted by raw estimate)"},
  y: {label: "Estimate ± 1.96 se", grid: true},
  color: {legend: true, domain: ["No pooling", "Multilevel"], range: ["#d6604d", "#2166ac"]},
  marks: [
    Plot.ruleX(mc.slice().sort((a, b) => a.y - b.y).map((d, i) => ({...d, i})), {x: d => d.i - 0.15, y1: d => d.y - 1.96 * sigma, y2: d => d.y + 1.96 * sigma, stroke: () => "No pooling", strokeOpacity: 0.6}),
    Plot.ruleX(mc.slice().sort((a, b) => a.y - b.y).map((d, i) => ({...d, i})), {x: d => d.i + 0.15, y1: d => d.pm - 1.96 * d.psd, y2: d => d.pm + 1.96 * d.psd, stroke: () => "Multilevel", strokeWidth: 2}),
    Plot.dot(mc.slice().sort((a, b) => a.y - b.y).map((d, i) => ({...d, i})), {x: "i", y: "theta", fill: "currentColor", r: 1.8}),
    Plot.ruleY([0])
  ]
})
# Multiple Comparisons: classical tests vs a multilevel model.
1tau <- 0.1 # spread of true effects
sigma <- 0.5 # standard error of each estimate
2set.seed(20)

theta <- rnorm(50, 0, tau) # 50 true effects, mostly tiny
3y <- rnorm(50, theta, sigma) # their noisy estimates

# Multilevel model (empirical Bayes): shrink toward the mean
mu <- mean(y)
4tau2 <- max(0, mean((y - mu)^2) - sigma^2)
B <- tau2 / (tau2 + sigma^2)
5pm <- mu + B * (y - mu) # posterior means
psd <- sqrt(B) * sigma + 1e-9 # posterior sds

6claim_classic <- abs(y) > 1.96 * sigma
7claim_ml <- B > 0 & abs(pm) > 1.96 * psd
cat("Classical: ", sum(claim_classic), " 'significant' effects, ",
  sum(claim_classic & sign(y) != sign(theta)), " with the wrong sign\n",
  "Multilevel: ", sum(claim_ml), " confident claims, ",
  sum(claim_ml & sign(pm) != sign(theta)), " with the wrong sign\n",
  sep = ""
)

8plot(theta, y,
  pch = ifelse(claim_classic, 19, 1), col = "#d6604d",
  xlab = "True effect", ylab = "Estimate"
)
points(theta, pm, pch = 19, col = "#2166ac")
abline(h = c(-1.96, 1.96) * sigma, lty = 2)
legend("topleft", c(
  "Raw estimate (filled if significant)",
  "Multilevel estimate"
),
pch = 19, col = c("#d6604d", "#2166ac"), bty = "n"
)
1
The page’s controls: the spread of the 50 true effects and the standard error of each estimate.
2
Fixes the random numbers so the run is reproducible.
3
Fifty noisy estimates of fifty mostly tiny effects.
4
The multilevel model’s estimate of the true spread, from the estimates and their known noise.
5
Partial pooling: each estimate shrunk toward the mean by the ratio of true spread to total spread.
6
The classical rule: claim an effect when the raw estimate is significant.
7
The multilevel rule: claim an effect when the posterior interval excludes zero.
8
Raw and pooled estimates against the truth, with the significance thresholds dashed. The pooled estimates make fewer and better claims.
# Multiple Comparisons: classical tests vs a multilevel model.
import numpy as np
import matplotlib.pyplot as plt

tau = 0.1    # spread of true effects
sigma = 0.5  # standard error of each estimate
rng = np.random.default_rng(25)

theta = rng.normal(0, tau, 50)   # 50 true effects, mostly tiny
y = rng.normal(theta, sigma)     # their noisy estimates

# Multilevel model (empirical Bayes): shrink toward the mean
mu = y.mean()
tau2 = max(0, np.mean((y - mu) ** 2) - sigma ** 2)
B = tau2 / (tau2 + sigma ** 2)
pm = mu + B * (y - mu)           # posterior means
psd = np.sqrt(B) * sigma + 1e-9  # posterior sds

claim_classic = np.abs(y) > 1.96 * sigma
claim_ml = (B > 0) & (np.abs(pm) > 1.96 * psd)
wrong_classic = claim_classic & (np.sign(y) != np.sign(theta))
wrong_ml = claim_ml & (np.sign(pm) != np.sign(theta))
print(f"Classical: {claim_classic.sum()} 'significant' effects, "
      f"{wrong_classic.sum()} with the wrong sign")
print(f"Multilevel: {claim_ml.sum()} confident claims, "
      f"{wrong_ml.sum()} with the wrong sign")

plt.scatter(theta, y, color="#d6604d", label="Raw estimate")
plt.scatter(theta[claim_classic], y[claim_classic], s=120,
            facecolors="none", edgecolors="black", label="'Significant'")
plt.scatter(theta, pm, color="#2166ac", label="Multilevel estimate")
plt.axhline(1.96 * sigma, color="black", linestyle="--")
plt.axhline(-1.96 * sigma, color="black", linestyle="--")
plt.xlabel("True effect")
plt.ylabel("Estimate")
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

  • The multiple-comparisons problem comes mostly from treating related effects as unrelated.
  • Partial pooling moves the estimates themselves, not just the widths of the intervals, and protects against noise-chasing automatically.
  • Bonferroni-style corrections keep the exaggerated point estimates and throw away power.

Source

Back to top