The house
Thinking about statistics
Law or aphorism
Intermediate
It’s stronger than the foundations.
What it is
Statistics’ philosophical foundations are still debated: what probability means, how to justify priors, whether p-values make sense. Yet the practice built on them works remarkably well. Regression, hierarchical models and sampling methods give useful answers in thousands of applications. The house stands even though the foundations are contested. In Gelman’s image, the house is stronger than the foundations.
He uses the expression about foundational work he considers misdirected: a “huge literature on simulation from the distribution of a discrete contingency table with known margins”, whose point is “to compute a p-value with respect to a completely uninteresting model in which margins are fixed”, and the years of effort on bootstrap confidence intervals, “inferences that are supposed to have specified coverage conditional on any value of the unknown parameters.” “I think it’s great when people come up with effective methods,” he writes. What irritates him is “when people tie themselves into knots trying to solve problems that in my opinion aren’t real.”
Why it matters
Practitioners sometimes take foundational disputes to mean the methods are unreliable. Others defend methods only by their foundations. Both miss the point: a method’s track record and its robustness to violated assumptions are evidence in their own right. Equally, a method that works in practice doesn’t need a perfect philosophical justification, as long as its limits are understood and checked.
How it works
Gelman’s examples are about theoretical foundations. Our toy model takes “foundations” in a narrower, technical sense: the textbook assumptions behind a method. Least squares regression is often “founded” on the assumption of normally distributed errors. But the coefficient estimates are unbiased, and with moderate samples the usual intervals are nearly calibrated, for a wide range of non-normal error distributions. The foundation is shaky, since errors are rarely normal, and the house still stands. Gauss–Markov conditions and the central limit theorem carry most of the weight.
Simulated example
Fit a regression with errors drawn from increasingly non-normal distributions and check whether the 95% intervals still cover the true slope.
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, lm, pct} from "../js/stats.js"
viewof errDist = Inputs.radio(["Normal (the foundation)", "Skewed (exponential)", "Heavy-tailed (t, 3 df)", "Bimodal"], {value: "Skewed (exponential)", label: "Error distribution"})
viewof n = Inputs.range([10, 300], {value: 50, step: 10, label: "Sample size"})
viewof seed = Inputs.range([1, 500], {value: 138, step: 1, label: "Random seed"})
house = {
const r = rng(seed);
const err = () => errDist.startsWith("Normal") ? r.normal() : errDist.startsWith("Skewed") ? r.exponential(1) - 1 : errDist.startsWith("Heavy") ? r.t(3) / Math.sqrt(3) : (r() < 0.5 ? -1 : 1) + r.normal(0, 0.3);
const reps = range(1500).map(() => {
const x = r.normals(n), y = x.map(v => 1 + 0.5 * v + err());
const f = lm(x, y);
return {b: f.b, cover: Math.abs(f.b - 0.5) < 1.96 * f.seB};
});
return {reps, residSample: range(800).map(() => err())};
}
html`<div style="display:flex; gap:1rem; flex-wrap:wrap">
${Plot.plot({
ariaLabel: "The house: The 'foundation': error distribution",
ariaDescription: "Horizontal axis: Error. The chart updates with the controls above it, and the summary below the charts states the result in words.",width: 320, height: 220, title: "The 'foundation': error distribution", x: {label: "Error"}, y: {label: null}, marks: [Plot.rectY(house.residSample, Plot.binX({y: "count"}, {x: d => d, fill: "#8a8a8a", thresholds: 40})), Plot.ruleY([0])]})}
${Plot.plot({
ariaLabel: "The house: The 'house': slope estimates",
ariaDescription: "Horizontal axis: Estimated slope (truth 0.5). The chart updates with the controls above it, and the summary below the charts states the result in words.",width: 320, height: 220, title: "The 'house': slope estimates", x: {label: "Estimated slope (truth 0.5)"}, y: {label: null}, marks: [Plot.rectY(house.reps, Plot.binX({y: "count"}, {x: "b", fill: "#2166ac", thresholds: 40})), Plot.ruleX([0.5], {stroke: "currentColor", strokeDasharray: "4 3"}), Plot.ruleY([0])]})}
</div>`# The house: regression with non-normal errors still stands.
1err_dist <- "Skewed" # "Normal", "Skewed", "Heavy-tailed" or "Bimodal"
n <- 50 # sample size
2set.seed(138)
3err <- function(m) {
switch(err_dist,
Normal = rnorm(m),
Skewed = rexp(m) - 1,
"Heavy-tailed" = rt(m, 3) / sqrt(3),
Bimodal = sample(c(-1, 1), m, replace = TRUE) + rnorm(m, 0, 0.3)
)
}
reps <- t(replicate(1500, {
x <- rnorm(n)
y <- 1 + 0.5 * x + err(n)
b <- cov(x, y) / var(x)
a <- mean(y) - b * mean(x)
4 se <- sqrt(sum((y - a - b * x)^2) / (n - 2) / sum((x - mean(x))^2))
c(b = b, cover = abs(b - 0.5) < 1.96 * se)
}))
cat("With ", tolower(err_dist), " errors and n = ", n, ", the 95% ",
"interval covers the true slope ", round(100 * mean(reps[, "cover"]), 1),
"% of the time\nAverage slope estimate: ",
round(mean(reps[, "b"]), 3), " (truth 0.5)\n",
sep = ""
)
5par(mfrow = c(1, 2))
hist(err(800),
breaks = 40, col = "grey70", border = "white",
main = "The errors", xlab = ""
)
hist(reps[, "b"],
breaks = 40, col = "#2166ac", border = "white",
main = "Slope estimates", xlab = ""
)
abline(v = 0.5, lwd = 2)- 1
- The page’s controls: the shape of the error distribution and the sample size.
- 2
- Fixes the random numbers so the run is reproducible.
- 3
- Errors that are anything but normal: the foundation the textbook assumes is missing.
- 4
- The usual least-squares standard error, derived under normality.
- 5
- The errors and the slope estimates. The house stands: the estimates center on the truth and the intervals still cover about 95% of the time.
# The house: regression with non-normal errors still stands.
import numpy as np
import matplotlib.pyplot as plt
err_dist = "Skewed" # "Normal", "Skewed", "Heavy-tailed" or "Bimodal"
n = 50 # sample size
rng = np.random.default_rng(138)
def err(size):
if err_dist == "Normal":
return rng.normal(size=size)
if err_dist == "Skewed":
return rng.exponential(1, size) - 1
if err_dist == "Heavy-tailed":
return rng.standard_t(3, size) / np.sqrt(3)
return rng.choice([-1, 1], size) + rng.normal(0, 0.3, size)
x = rng.normal(size=(1500, n))
y = 1 + 0.5 * x + err((1500, n))
xc = x - x.mean(axis=1, keepdims=True)
b = np.sum(xc * y, axis=1) / np.sum(xc ** 2, axis=1)
a = y.mean(axis=1) - b * x.mean(axis=1)
resid = y - a[:, None] - b[:, None] * x
se = np.sqrt(np.sum(resid ** 2, axis=1) / (n - 2) / np.sum(xc ** 2, axis=1))
cover = np.abs(b - 0.5) < 1.96 * se
print(f"With {err_dist.lower()} errors and n = {n}, the 95% interval "
f"covers the true slope {100 * cover.mean():.1f}% of the time")
print(f"Average slope estimate: {b.mean():.3f} (truth 0.5)")
fig, ax = plt.subplots(1, 2, figsize=(9, 4))
ax[0].hist(err(800), bins=40, color="0.7")
ax[0].set_title("The errors")
ax[1].hist(b, bins=40, color="#2166ac")
ax[1].axvline(0.5, color="black", linewidth=2)
ax[1].set_title("Slope estimates")
plt.show()Key takeaways
- Statistical practice is often more robust than its textbook justifications suggest.
- Judge methods by their performance and robustness, not only by their foundations.
- Know where the house creaks, as with very small samples or extreme violations, and check there.
Source
- Andrew Gelman, The house is stronger than the foundations (2017).