Preregistration
Noise and evidence
Advice
Intermediate
It’s a floor, not a ceiling.
What it is
Preregistration means specifying your analysis before seeing the data. It sets a floor: the preregistered analysis must be done and reported, whatever it shows. It is not a ceiling. You can, and often should, go beyond it with better models, additional covariates, multilevel structure and exploratory analyses, as long as you clearly label which is which.
Why it matters
Some researchers treat preregistration as a cage, a set of analyses beyond which nothing may be done. That throws away information. Preregistered plans are written before seeing the data and are usually simple. Better analyses, such as adjusting for a pre-test or partially pooling across sites, often only become clearly appropriate once the data are in. Preregistration guards against the garden of forking paths by guaranteeing the floor. It shouldn’t prevent you from using the data well.
How it works
Report the preregistered analysis in full. Then add the improved analyses, labeled as such. Readers can see whether the conclusions agree. If they do, good. If they don’t, readers learn something about how sensitive the result is. Either way, nothing is hidden and nothing is wasted.
Simulated example
A preregistered plan uses a simple difference in means. After seeing the data, the analyst also runs an analysis adjusted for a strongly predictive baseline covariate, labeled as exploratory. Compare their precision over 500 replications.
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, fmt, pct} from "../js/stats.js"
viewof rho = Inputs.range([0, 0.9], {value: 0.7, step: 0.05, label: "Correlation of baseline covariate with outcome"})
viewof n = Inputs.range([20, 300], {value: 60, step: 10, label: "Participants per arm"})
viewof seed = Inputs.range([1, 500], {value: 133, step: 1, label: "Random seed"})
prereg = {
const r = rng(seed);
const effect = 0.3;
return range(500).map(k => {
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 floorEst = mean(t) - mean(c), floorSe = 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));
return {k, floorEst, floorSe, adjEst: adj.coef[1], adjSe: adj.se[1], effect};
});
}
Plot.plot({
ariaLabel: "Preregistration: simulation chart",
ariaDescription: "Horizontal axis: Estimate of the treatment effect (true = 0.3). Vertical axis: Replications. The chart updates with the controls above it, and the summary below the charts states the result in words.",
height: 260,
x: {label: "Estimate of the treatment effect (true = 0.3)", grid: true},
y: {label: "Replications"},
color: {legend: true, domain: ["Preregistered (the floor)", "Plus labeled exploratory analysis"], range: ["#8a8a8a", "#2166ac"]},
marks: [
Plot.rectY(prereg, Plot.binX({y: "count"}, {x: "floorEst", fill: () => "Preregistered (the floor)", fillOpacity: 0.5, thresholds: 40})),
Plot.rectY(prereg, Plot.binX({y: "count"}, {x: "adjEst", fill: () => "Plus labeled exploratory analysis", fillOpacity: 0.6, thresholds: 40})),
Plot.ruleX([0.3], {stroke: "currentColor", strokeDasharray: "4 3"}),
Plot.ruleY([0])
]
})# Preregistration: a plan that adjusts for a baseline covariate.
1rho <- 0.7 # correlation of the baseline covariate with the outcome
n <- 60 # participants per arm
2set.seed(133)
effect <- 0.3
res <- t(replicate(500, {
z <- rep(1:0, each = n)
x <- rnorm(2 * n)
y <- effect * z + rho * x + sqrt(1 - rho^2) * rnorm(2 * n)
3 floor <- t.test(y[z == 1], y[z == 0]) # difference in means
4 adj <- summary(lm(y ~ z + x))$coefficients["z", 1:2]
c(
floor_est = unname(diff(rev(floor$estimate))),
floor_se = floor$stderr, adj_est = adj[[1]], adj_se = adj[[2]]
)
}))
5cover <- function(e, s) mean(abs(res[, e] - effect) < 1.96 * res[, s])
cat("Difference in means: average se ", round(mean(res[, "floor_se"]), 3),
", coverage ", round(100 * cover("floor_est", "floor_se")), "%\n",
"Adjusted for baseline: average se ", round(mean(res[, "adj_se"]), 3),
", coverage ", round(100 * cover("adj_est", "adj_se")), "%\n",
sep = ""
)
6boxplot(res[, c("floor_est", "adj_est")],
col = c("grey70", "#2166ac"),
names = c("Difference in means", "Adjusted for baseline"),
ylab = "Estimated effect"
)
abline(h = effect, lty = 2)- 1
- The page’s controls: how strongly the baseline covariate predicts the outcome, and the participants per arm.
- 2
- Fixes the random numbers so the run is reproducible.
- 3
- The preregistered floor: a plain difference in means.
- 4
- The preregistered plan’s better analysis: adjust for the baseline covariate, which was named in advance.
- 5
- Coverage of each method’s intervals, to show the adjustment is honest.
- 6
- Both estimates across 500 trials. Preregistration is a floor, not a ceiling: the planned adjustment is more precise and just as valid.
# Preregistration: a plan that adjusts for a baseline covariate.
import numpy as np
import matplotlib.pyplot as plt
rho = 0.7 # correlation of the baseline covariate with the outcome
n = 60 # participants per arm
rng = np.random.default_rng(133)
effect = 0.3
z = np.repeat([1, 0], n)
floor_est, floor_se, adj_est, adj_se = [], [], [], []
for _ in range(500):
x = rng.normal(size=2 * n)
y = effect * z + rho * x + np.sqrt(1 - rho ** 2) * rng.normal(size=2 * n)
t, c = y[z == 1], y[z == 0]
floor_est.append(t.mean() - c.mean()) # difference in means
floor_se.append(np.sqrt(t.var(ddof=1) / n + c.var(ddof=1) / n))
X = np.column_stack([np.ones(2 * n), z, x]) # adjusted regression
beta, *_ = np.linalg.lstsq(X, y, rcond=None)
s2 = np.sum((y - X @ beta) ** 2) / (2 * n - 3)
adj_est.append(beta[1])
adj_se.append(np.sqrt(s2 * np.linalg.inv(X.T @ X)[1, 1]))
def cover(e, s):
return 100 * np.mean(np.abs(np.array(e) - effect) < 1.96 * np.array(s))
print(f"Difference in means: average se {np.mean(floor_se):.3f}, "
f"coverage {cover(floor_est, floor_se):.0f}%")
print(f"Adjusted for baseline: average se {np.mean(adj_se):.3f}, "
f"coverage {cover(adj_est, adj_se):.0f}%")
plt.boxplot([floor_est, adj_est])
plt.xticks([1, 2], ["Difference in means", "Adjusted for baseline"])
plt.axhline(effect, color="black", linestyle="--")
plt.ylabel("Estimated effect")
plt.show()Key takeaways
- Preregistration guarantees a minimum analysis. It doesn’t forbid better ones.
- Report the preregistered analysis in full, then add improvements labeled as exploratory.
- Compare the two. Agreement is reassuring and disagreement is informative.
Source
- Andrew Gelman, What’s the difference between Derek Jeter and preregistration? (2022).