Skip to main content

The most important aspect of a statistical method

Building and checking models
Principle or heuristic
Intermediate
not what it does with the data but rather what data it uses.
Published

November 9, 2026

Modified

November 13, 2026

Entry #66 in Andrew Gelman’s Handy Statistical Lexicon. Original discussion: Regression: What’s it all about? (Bayesian and otherwise).

Filed under Building and checking models · Principle or heuristic · Intermediate.

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

What it is

Debates about statistical methods focus on the procedure: Bayesian or frequentist, maximum likelihood or method of moments, which estimator. Gelman’s point is that in practice the biggest differences between methods usually come from what information they bring in: pre-treatment covariates, related groups, prior studies, the structure of the design. A Bayesian and a frequentist using the same data in the same model get similar answers. A method that uses more relevant data can do far better.

Why it matters

Methodological arguments can be a distraction. If you want better estimates, the highest-leverage question is usually what other data could inform this? Possible answers include a pre-test score, data on related populations, historical controls or measurement-error information. The advantages credited to Bayesian methods often come from their ease of including such information through priors and hierarchical structure, not from the inference engine itself.

How it works

Take a randomized experiment with outcome \(y\) and treatment \(z\). The difference in means has standard error \(\sigma\sqrt{2/n}\), where \(\sigma\) is the outcome’s standard deviation. Adjusting for a pre-test \(x\) correlated \(\rho\) with \(y\) reduces the residual variance by a factor \((1 - \rho^2)\). With \(\rho = 0.8\), the standard error falls by 40%, which is equivalent to almost tripling the sample size. Switching from a frequentist to a Bayesian analysis of the same outcome-only data barely changes anything.

Simulated example

There are 300 replications of an experiment. Compare four analyses: the outcome-only frequentist analysis, the outcome-only Bayesian analysis with a weak prior, a frequentist analysis adjusting for a pre-test, and a Bayesian analysis adjusting for it.

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

viewof rho = Inputs.range([0, 0.95], {value: 0.8, step: 0.05, label: "Pre-test correlation with outcome ρ"})
viewof n = Inputs.range([20, 400], {value: 60, step: 10, label: "Participants per arm"})
viewof seed = Inputs.range([1, 500], {value: 66, step: 1, label: "Random seed"})

methods = {
  const r = rng(seed);
  const effect = 0.3, out = {a: [], b: [], c: [], d: []};
  for (let rep = 0; rep < 300; rep++) {
    const rows = range(2 * n).map(i => {
      const z = i < n ? 1 : 0, x = r.normal();
      return {z, x, y: effect * z + rho * x + Math.sqrt(1 - rho * rho) * r.normal()};
    });
    const t = rows.filter(d => d.z).map(d => d.y), c = rows.filter(d => !d.z).map(d => d.y);
    const diff = mean(t) - mean(c), seDiff = Math.sqrt(sd(t) ** 2 / n + sd(c) ** 2 / n);
    const adj = ols(rows.map(d => [d.z, d.x]), rows.map(d => d.y));
    out.a.push(diff);
    out.b.push(normalPosterior(0, 1, diff, seDiff).mean);
    out.c.push(adj.coef[1]);
    out.d.push(normalPosterior(0, 1, adj.coef[1], adj.se[1]).mean);
  }
  const rmse = v => Math.sqrt(mean(v.map(e => (e - effect) ** 2)));
  return [
    {m: "Frequentist, outcome only", rmse: rmse(out.a), data: "Outcome only"},
    {m: "Bayesian, outcome only", rmse: rmse(out.b), data: "Outcome only"},
    {m: "Frequentist + pre-test", rmse: rmse(out.c), data: "Uses pre-test"},
    {m: "Bayesian + pre-test", rmse: rmse(out.d), data: "Uses pre-test"}
  ];
}

Plot.plot({
  ariaLabel: "The most important aspect of a statistical method: simulation chart",
  ariaDescription: "Horizontal axis: RMSE of the treatment-effect estimate. The chart updates with the controls above it, and the summary below the charts states the result in words.",
  height: 200,
  marginLeft: 180,
  x: {label: "RMSE of the treatment-effect estimate", grid: true},
  y: {label: null},
  color: {legend: true, range: ["#d6604d", "#2166ac"]},
  marks: [Plot.barX(methods, {y: "m", x: "rmse", fill: "data"}), Plot.ruleX([0])]
})
# The most important aspect of a statistical method is what data it uses.
1rho <- 0.8 # pre-test correlation with the outcome
n <- 60 # participants per arm
2set.seed(66)

effect <- 0.3
3shrink <- function(est, se) (est / se^2) / (1 + 1 / se^2) # N(0, 1) prior
est <- t(replicate(300, {
  z <- rep(1:0, each = n)
  x <- rnorm(2 * n)
  y <- effect * z + rho * x + sqrt(1 - rho^2) * rnorm(2 * n)
4  d <- mean(y[z == 1]) - mean(y[z == 0])
  se_d <- sqrt(var(y[z == 1]) / n + var(y[z == 0]) / n)
5  adj <- summary(lm(y ~ z + x))$coefficients["z", 1:2]
  c(
    "Frequentist, outcome only" = d, "Bayesian, outcome only" =
      shrink(d, se_d), "Frequentist + pre-test" = adj[[1]],
    "Bayesian + pre-test" = shrink(adj[[1]], adj[[2]])
  )
}))
rmse <- sqrt(colMeans((est - effect)^2))
print(round(rmse, 3)) # root mean squared error of each method

par(mar = c(4, 12, 1, 1))
6barplot(rev(rmse),
  horiz = TRUE, las = 1, cex.names = 0.8,
  col = c("#2166ac", "#2166ac", "grey70", "grey70"),
  xlab = "Root mean squared error"
)
1
The page’s controls: how well the pre-test predicts the outcome, and the participants per arm.
2
Fixes the random numbers so the run is reproducible.
3
The Bayesian ingredient: shrinkage under a standard normal prior.
4
The outcome-only estimate.
5
The estimate that also uses the pre-test.
6
Error of all four methods. Switching philosophy changes little; adding the pre-test data changes a lot. What matters most is what data the method uses.
# The most important aspect of a statistical method is what data it uses.
import numpy as np
import matplotlib.pyplot as plt

rho = 0.8  # pre-test correlation with the outcome
n = 60     # participants per arm
rng = np.random.default_rng(66)

effect = 0.3
z = np.repeat([1, 0], n)
X = np.column_stack([np.ones(2 * n), z, np.zeros(2 * n)])


def shrink(est, se):  # posterior mean with a N(0, 1) prior
    return (est / se ** 2) / (1 + 1 / se ** 2)


est = {"Frequentist, outcome only": [], "Bayesian, outcome only": [],
       "Frequentist + pre-test": [], "Bayesian + pre-test": []}
for _ in range(300):
    x = rng.normal(size=2 * n)
    y = effect * z + rho * x + np.sqrt(1 - rho ** 2) * rng.normal(size=2 * n)
    d = y[z == 1].mean() - y[z == 0].mean()
    se_d = np.sqrt(y[z == 1].var(ddof=1) / n + y[z == 0].var(ddof=1) / n)
    X[:, 2] = x
    beta, *_ = np.linalg.lstsq(X, y, rcond=None)
    s2 = np.sum((y - X @ beta) ** 2) / (2 * n - 3)
    se_b = np.sqrt(s2 * np.linalg.inv(X.T @ X)[1, 1])
    for k, v in zip(est, [d, shrink(d, se_d), beta[1],
                          shrink(beta[1], se_b)]):
        est[k].append(v)
rmse = {k: np.sqrt(np.mean((np.array(v) - effect) ** 2))
        for k, v in est.items()}
for k, v in rmse.items():
    print(f"{k}: RMSE {v:.3f}")

plt.barh(list(rmse)[::-1], list(rmse.values())[::-1],
         color=["#2166ac", "#2166ac", "0.7", "0.7"])
plt.xlabel("Root mean squared error")
plt.tight_layout()
plt.show()

Key takeaways

  • The largest gains usually come from using more relevant information, not from a cleverer procedure.
  • Before arguing about Bayesian versus frequentist, ask what pre-treatment, related or prior data you could include.
  • Much of Bayesian methods’ practical advantage is how easily they incorporate extra information.

Source

Back to top