Skip to main content

WWJD

Building and checking models
Principle or heuristic
Intermediate
What I think of when I’m stuck on an applied statistics problem.
Published

November 9, 2026

Modified

November 13, 2026

Entry #11 in Andrew Gelman’s Handy Statistical Lexicon. Original discussion: Can our book be used in an econ course??.

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

Source check: ✓ The explanation was checked against the source. The post doesn’t expand the acronym; our reading of it is labeled as such.

What it is

The linked post never spells out the acronym. It is about whether Gelman’s regression book with Jennifer Hill would suit an econometrics course. Reading WWJD as “What Would Jennifer Do?” is our inference from that context, and so is the checklist below. Jennifer Hill is Gelman’s co-author on Data Analysis Using Regression and Multilevel/Hierarchical Models. When stuck on an applied problem, Gelman imagines how a thoughtful, practical colleague would approach it. The idea generalizes: keep a mental model of a specific expert whose judgment you trust, and ask what they would check first.

Why it matters

When stuck, analysts tend to reach for more complicated machinery. A good applied statistician more often reaches for something basic. Look at the raw data. Check whether treated and control units are actually comparable. Ask what the estimand is. Imagining a concrete person helps you step outside your own rut and recall the checks you know you should do.

How it works

The heuristic is a perspective shift, not an algorithm. A typical WWJD checklist for a causal question might be:

  1. What is the treatment, and what is the comparison?
  2. Do treated and control units overlap on the important covariates, or is the regression extrapolating into empty space?
  3. What does a simple graph of outcome against key covariates by group show?
  4. Would the conclusion survive restricting to the region of common support?

Hill’s research on causal inference emphasizes exactly these overlap and balance checks, so they make a fitting illustration.

Simulated example

An observational study where the treated units sit at high values of a covariate and the control units are spread more widely. The true treatment effect is exactly 1. The outcome curves with the covariate, but the naive model is linear and fits everyone, so it extrapolates into regions where one group has no data. The WWJD move is to check overlap and estimate the effect only where both groups have data.

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

viewof separation = Inputs.range([0, 3], {value: 2, step: 0.1, label: "Covariate gap between groups"})
viewof curvature = Inputs.range([0, 1], {value: 0.5, step: 0.05, label: "Nonlinearity in outcome"})
viewof seed = Inputs.range([1, 500], {value: 6, step: 1, label: "Random seed"})

obs = {
  const r = rng(seed);
  return range(600).map(() => {
    const z = r.bernoulli(0.5);
    const x = z ? r.normal(separation, 0.6) : r.normal(0, 1.2);
    const effect = 1;                          // true treatment effect
    const y = curvature * x * x + effect * z + r.normal(0, 1);
    return {x, z, y, effect, group: z ? "Treated" : "Control"};
  });
}
results = {
  const all = ols(obs.map(d => [d.z, d.x]), obs.map(d => d.y)).coef[1];
  const lo = Math.max(...["Treated", "Control"].map(g => Math.min(...obs.filter(d => d.group === g).map(d => d.x))));
  const hi = Math.min(...["Treated", "Control"].map(g => Math.max(...obs.filter(d => d.group === g).map(d => d.x))));
  const cs = obs.filter(d => d.x >= lo && d.x <= hi);
  const restricted = ols(cs.map(d => [d.z, d.x, d.x * d.x]), cs.map(d => d.y)).coef[1];
  return {all, restricted, lo, hi, nCS: cs.length, trueCS: mean(cs.map(d => d.effect))};
}

Plot.plot({
  ariaLabel: "WWJD: simulation chart",
  ariaDescription: "Horizontal axis: Covariate x. Vertical axis: Outcome y. The chart updates with the controls above it, and the summary below the charts states the result in words.",
  height: 320,
  x: {label: "Covariate x", grid: true},
  y: {label: "Outcome y", grid: true},
  color: {legend: true, range: ["#d6604d", "#2166ac"], domain: ["Control", "Treated"]},
  marks: [
    Plot.rect([0], {x1: results.lo, x2: results.hi, y1: -4, y2: 14, fill: "#8a8a8a", fillOpacity: 0.1}),
    Plot.dot(obs, {x: "x", y: "y", stroke: "group", r: 2, strokeOpacity: 0.6}),
    Plot.text([0], {x: (results.lo + results.hi) / 2, y: 13.5, text: () => "common support"})
  ]
})
# WWJD (What would Jennifer Hill do?): restrict to the region of overlap.
1separation <- 2 # covariate gap between groups
curvature <- 0.5 # nonlinearity in the outcome
2set.seed(6)

z <- rbinom(600, 1, 0.5)
3x <- ifelse(z == 1, rnorm(600, separation, 0.6), rnorm(600, 0, 1.2))
y <- curvature * x^2 + 1 * z + rnorm(600) # true treatment effect: 1

4naive <- coef(lm(y ~ z + x))[["z"]]
lo <- max(tapply(x, z, min))
hi <- min(tapply(x, z, max))
5cs <- x >= lo & x <= hi # common support
6restricted <- coef(lm(y ~ z + x + I(x^2), subset = cs))[["z"]]
cat("Naive linear regression, all units: ", round(naive, 2), "\n",
  "Overlap only (", sum(cs), " units), with a quadratic: ",
  round(restricted, 2), "\nTrue effect: 1\n",
  sep = ""
)

7plot(x, y,
  pch = 19, cex = 0.5, col = ifelse(z == 1, "#d6604d", "#2166ac"),
  xlab = "Covariate x", ylab = "Outcome y"
)
rect(lo, -100, hi, 100, col = adjustcolor("grey", 0.2), border = NA)
legend("topleft", c("Treated", "Control"),
  pch = 19,
  col = c("#d6604d", "#2166ac"), bty = "n"
)
1
The page’s controls: how far apart the treated and control groups sit on the covariate, and how curved the outcome is.
2
Fixes the random numbers so the run is reproducible.
3
Treated units cluster at high values of the covariate; controls spread more widely.
4
The naive answer: a linear regression on everyone, which extrapolates into regions where one group has no data.
5
The WWJD check: where do both groups have data?
6
The answer restricted to that region, with a flexible fit.
7
The data with the region of common support shaded.
# WWJD (What would Jennifer Hill do?): restrict to the region of overlap.
import numpy as np
import matplotlib.pyplot as plt

separation = 2   # covariate gap between groups
curvature = 0.5  # nonlinearity in the outcome
rng = np.random.default_rng(6)

z = rng.binomial(1, 0.5, 600)
x = np.where(z == 1, rng.normal(separation, 0.6, 600),
             rng.normal(0, 1.2, 600))
y = curvature * x ** 2 + 1 * z + rng.normal(size=600)  # true effect: 1


def coef_z(cols, keep):  # OLS coefficient on z
    X = np.column_stack([np.ones(keep.sum())] + [c[keep] for c in cols])
    return np.linalg.lstsq(X, y[keep], rcond=None)[0][1]


everyone = np.ones(600, dtype=bool)
naive = coef_z([z, x], everyone)
lo = max(x[z == 1].min(), x[z == 0].min())
hi = min(x[z == 1].max(), x[z == 0].max())
cs = (x >= lo) & (x <= hi)                 # common support
restricted = coef_z([z, x, x ** 2], cs)
print(f"Naive linear regression, all units: {naive:.2f}")
print(f"Overlap only ({cs.sum()} units), with a quadratic: "
      f"{restricted:.2f}\nTrue effect: 1")

plt.axvspan(lo, hi, color="0.9")
plt.scatter(x, y, s=6, c=np.where(z == 1, "#d6604d", "#2166ac"))
plt.xlabel("Covariate x (shaded: overlap)")
plt.ylabel("Outcome y")
plt.show()

Key takeaways

  • When stuck, picture a specific, sensible expert and ask what they would check first.
  • The answer is usually something basic: plot the data, check overlap, define the estimand.
  • In causal problems, overlap and balance checks often matter more than the choice of model.

Source

Back to top