Skip to main content

Theoretical statistics

Thinking about statistics
Law or aphorism
Advanced
The theory of applied statistics.
Published

November 9, 2026

Modified

November 13, 2026

Entry #121 in Andrew Gelman’s Handy Statistical Lexicon. Original discussion: Theoretical statistics is the theory of applied statistics: how to think about what we do.

Filed under Thinking about statistics · Law or aphorism · Advanced.

Related terms: post-selection inference, pretest estimator, model selection.

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

What it is

Gelman argues that theoretical statistics should be the theory of applied statistics: the study of what practitioners actually do. That includes the messy parts, such as checking a model and revising it, choosing among specifications after looking at the data, and stopping when the results look reasonable. Textbook theory often studies idealized procedures with a fixed model and a fixed analysis that nobody really follows. The theory that matters describes the procedure as it is actually carried out.

Why it matters

A procedure’s real properties depend on the whole workflow, not on one step considered alone. The classic example is post-selection inference: test whether a variable matters, keep it if it’s significant, then report the usual confidence interval. Each step has textbook theory, but the combination has different coverage. Theory that ignores how analyses are actually done certifies properties those analyses don’t have.

How it works

Consider a common practice. Fit \(y = \beta_1 x_1 + \beta_2 x_2 + \epsilon\). If \(x_2\) isn’t significant, drop it and refit. Then report the 95% interval for \(\beta_1\). When \(x_1\) and \(x_2\) are correlated and \(\beta_2\) is small but not zero, dropping \(x_2\) biases \(\hat\beta_1\), and the reported interval doesn’t account for the selection step. The theory of the actual procedure, worked out here by simulation, shows coverage well below 95%.

Simulated example

Compare the coverage the textbook promises (95%) with the coverage of the procedure as practiced: pretest, maybe drop, then report.

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

viewof beta2 = Inputs.range([0, 0.6], {value: 0.2, step: 0.02, label: "True effect of x₂ (β₂)"})
viewof rhoX = Inputs.range([0, 0.95], {value: 0.7, step: 0.05, label: "Correlation between x₁ and x₂"})
viewof seed = Inputs.range([1, 500], {value: 121, step: 1, label: "Random seed"})

practice = {
  const r = rng(seed);
  const beta1 = 0.5, n = 80;
  let covFixed = 0, covPractice = 0, dropped = 0;
  const reps = 1000;
  for (let k = 0; k < reps; k++) {
    const rows = range(n).map(() => { const x1 = r.normal(), x2 = rhoX * x1 + Math.sqrt(1 - rhoX * rhoX) * r.normal(); return {x1, x2, y: beta1 * x1 + beta2 * x2 + r.normal()}; });
    const full = ols(rows.map(d => [d.x1, d.x2]), rows.map(d => d.y));
    const inFull = Math.abs(full.coef[1] - beta1) < 1.96 * full.se[1];
    covFixed += inFull;
    if (Math.abs(full.coef[2] / full.se[2]) < 1.96) {
      dropped++;
      const red = ols(rows.map(d => [d.x1]), rows.map(d => d.y));
      covPractice += Math.abs(red.coef[1] - beta1) < 1.96 * red.se[1];
    } else covPractice += inFull;
  }
  return [
    {proc: "Textbook: always fit the full model", cov: covFixed / reps},
    {proc: "Practice: pretest x₂, drop if n.s., report", cov: covPractice / reps}
  ].map(d => ({...d, dropped: dropped / reps}));
}

Plot.plot({
  ariaLabel: "Theoretical statistics: simulation chart",
  ariaDescription: "Horizontal axis: Actual coverage of the 'nominal 95%' interval for β₁. The chart updates with the controls above it, and the summary below the charts states the result in words.",
  height: 170,
  marginLeft: 280,
  x: {label: "Actual coverage of the 'nominal 95%' interval for β₁", domain: [0, 1], tickFormat: "%", grid: true},
  y: {label: null},
  marks: [Plot.barX(practice, {y: "proc", x: "cov", fill: (d, i) => i ? "#d6604d" : "#2166ac"}), Plot.ruleX([0.95], {stroke: "currentColor", strokeDasharray: "4 3"})]
})
# Theoretical statistics is the theory of applied statistics: analyze the
# procedure people actually use.
1beta2 <- 0.2 # true effect of x2
rho_x <- 0.7 # correlation between x1 and x2
2set.seed(121)

beta1 <- 0.5
n <- 80
res <- t(replicate(1000, {
  x1 <- rnorm(n)
  x2 <- rho_x * x1 + sqrt(1 - rho_x^2) * rnorm(n)
  y <- beta1 * x1 + beta2 * x2 + rnorm(n)
  full <- summary(lm(y ~ x1 + x2))$coefficients
3  in_full <- abs(full["x1", 1] - beta1) < 1.96 * full["x1", 2]
4  drop <- abs(full["x2", 3]) < 1.96 # pretest: drop x2 if n.s.
  if (drop) {
5    red <- summary(lm(y ~ x1))$coefficients
    in_used <- abs(red["x1", 1] - beta1) < 1.96 * red["x1", 2]
  } else {
    in_used <- in_full
  }
  c(textbook = in_full, practice = in_used, dropped = drop)
}))
cat("x2 dropped in ", round(100 * mean(res[, "dropped"])), "% of datasets\n",
  "Coverage of the reported 95% interval: textbook ",
  round(100 * mean(res[, "textbook"]), 1), "%, as practiced ",
  round(100 * mean(res[, "practice"]), 1), "%\n",
  sep = ""
)

6barplot(100 * colMeans(res[, 1:2]),
  col = c("#2166ac", "#d6604d"),
  names.arg = c("Always fit the full model", "Pretest, drop, report"),
  ylab = "Coverage of the 95% interval (%)", ylim = c(0, 100)
)
abline(h = 95, lty = 2)
1
The page’s controls: the true effect of the second predictor and its correlation with the first.
2
Fixes the random numbers so the run is reproducible.
3
The textbook procedure: always fit the full model and report its interval.
4
The procedure as practiced: pretest the second predictor and drop it if it isn’t significant.
5
After dropping it, report the reduced model’s interval as if nothing had happened.
6
Coverage of the two procedures. The theory that matters is the theory of what analysts actually do.
# Theoretical statistics is the theory of applied statistics: analyze the
# procedure people actually use.
import numpy as np
import matplotlib.pyplot as plt

beta2 = 0.2  # true effect of x2
rho_x = 0.7  # correlation between x1 and x2
rng = np.random.default_rng(121)

beta1, n = 0.5, 80


def ols(X, y):  # coefficients and standard errors, with an intercept
    X = np.column_stack([np.ones(len(y)), X])
    beta, *_ = np.linalg.lstsq(X, y, rcond=None)
    s2 = np.sum((y - X @ beta) ** 2) / (len(y) - X.shape[1])
    return beta, np.sqrt(s2 * np.diag(np.linalg.inv(X.T @ X)))


textbook = practice = dropped = 0
for _ in range(1000):
    x1 = rng.normal(size=n)
    x2 = rho_x * x1 + np.sqrt(1 - rho_x ** 2) * rng.normal(size=n)
    y = beta1 * x1 + beta2 * x2 + rng.normal(size=n)
    b, se = ols(np.column_stack([x1, x2]), y)
    in_full = abs(b[1] - beta1) < 1.96 * se[1]
    textbook += in_full
    if abs(b[2] / se[2]) < 1.96:          # pretest: drop x2 if n.s.
        dropped += 1
        b, se = ols(x1, y)
        practice += abs(b[1] - beta1) < 1.96 * se[1]
    else:
        practice += in_full
print(f"x2 dropped in {dropped / 10:.0f}% of datasets")
print(f"Coverage of the reported 95% interval: textbook "
      f"{textbook / 10:.1f}%, as practiced {practice / 10:.1f}%")

plt.bar(["Always fit the full model", "Pretest, drop, report"],
        [textbook / 10, practice / 10], color=["#2166ac", "#d6604d"])
plt.axhline(95, color="black", linestyle="--")
plt.ylim(0, 100)
plt.ylabel("Coverage of the 95% interval (%)")
plt.show()

Key takeaways

  • Theory should describe the whole workflow as it’s practiced, not idealized single steps.
  • Data-dependent choices change a procedure’s properties. Simulate the real procedure to learn them.
  • Applied practice raises the questions that theory should answer.

Source

Back to top