The year Jesus was born
Building and checking models
Advice
Intermediate
Be careful when centering and scaling your regression predictors.
What it is
Gelman’s example: regress the world record time in the mile run (1913–1999) on year. The slope makes sense: the record dropped by about 0.4 seconds per year. The intercept is about 1006 seconds, which is the predicted record time “in the year that Jesus was born,” two thousand years outside the data. The lesson is to center (and sensibly scale) predictors, so that coefficients describe something inside the data.
Why it matters
An intercept, or any coefficient, is evaluated where the other predictors equal zero. With raw calendar years, zero is far away. The intercept becomes a meaningless extrapolation, its standard error is inflated by the distance, and in models with interactions the “main effects” are evaluated at year 0 too. Centering changes none of the fitted values or predictions. It changes whether the reported numbers mean anything.
How it works
Fit \(y = a + b\,(\text{year} - c)\). With \(c = 0\), \(a\) is the prediction for year 0. With \(c = 1950\), \(a\) is the prediction for 1950, in the middle of the data, and its standard error is small. The slope \(b\) is the same either way. Rescaling, for example years to decades, changes the units of \(b\) to make it readable. In models with interactions, centering is what makes the main effects interpretable.
Simulated example
The data are the 32 men’s world records in the mile from 1913 to 1999, so there is nothing random here. Choose where to center the year and compare the coefficients.
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 {lm, fmt} from "../js/stats.js"
viewof center = Inputs.radio(["Year 0 (no centering)", "Year 1950", "Mean year of the data"], {value: "Year 0 (no centering)", label: "Center year at"})
mile = {
// Men's world records in the mile, 1913–1999, in seconds.
const rows = [[1913, 254.4], [1915, 252.6], [1923, 250.4], [1931, 249.2], [1933, 247.6], [1934, 246.8], [1937, 246.4], [1942, 246.2],
[1942, 246.2], [1942, 244.6], [1943, 242.6], [1944, 241.6], [1945, 241.4], [1954, 239.4], [1954, 238.0], [1957, 237.2],
[1958, 234.5], [1962, 234.4], [1964, 234.1], [1965, 233.6], [1966, 231.3], [1967, 231.1], [1975, 231.0], [1975, 229.4],
[1979, 229.0], [1980, 228.8], [1981, 228.53], [1981, 228.40], [1981, 227.33], [1985, 226.32], [1993, 224.39], [1999, 223.13]]
.map(([year, time]) => ({year, time}));
const years = rows.map(d => d.year);
const meanYear = years.reduce((a, b) => a + b, 0) / years.length;
const c = center.startsWith("Year 0") ? 0 : center === "Year 1950" ? 1950 : meanYear;
const f = lm(rows.map(d => d.year - c), rows.map(d => d.time));
return {rows, c, f};
}
html`<table class="table table-sm" style="max-width: 460px;"><thead><tr><th>Coefficient</th><th style="text-align:right">Estimate</th><th style="text-align:right">SE</th><th>Meaning</th></tr></thead>
<tbody>
<tr><td>Intercept</td><td style="text-align:right">${fmt(mile.f.a, 1)}</td><td style="text-align:right">${fmt(mile.f.seA, 2)}</td><td>record time in year ${fmt(mile.c, 0)}</td></tr>
<tr><td>Year</td><td style="text-align:right">${fmt(mile.f.b, 3)}</td><td style="text-align:right">${fmt(mile.f.seB, 3)}</td><td>seconds per year</td></tr>
</tbody></table>`
Plot.plot({
ariaLabel: "The year Jesus was born: simulation chart",
ariaDescription: "Horizontal axis: Year. Vertical axis: World record, mile (seconds). The chart updates with the controls above it, and the summary below the charts states the result in words.",
height: 260,
x: {label: "Year", tickFormat: "d", grid: true},
y: {label: "World record, mile (seconds)", grid: true},
marks: [
Plot.dot(mile.rows, {x: "year", y: "time", fill: "#2166ac", r: 3}),
Plot.line([1913, 1999].map(x => ({x, y: mile.f.a + mile.f.b * (x - mile.c)})), {x: "x", y: "y", stroke: "#d6604d", strokeWidth: 2}),
Plot.ruleX([mile.c], {stroke: "currentColor", strokeDasharray: "4 3"})
]
})# The year Jesus was born: center your predictors.
1center <- 0 # 0 (no centering), 1950, or "mean"
# Deterministic: no random numbers. Men's world records in the mile,
# 1913-1999, in seconds.
2mile <- data.frame(
year = c(
1913, 1915, 1923, 1931, 1933, 1934, 1937, 1942, 1942, 1942,
1943, 1944, 1945, 1954, 1954, 1957, 1958, 1962, 1964, 1965,
1966, 1967, 1975, 1975, 1979, 1980, 1981, 1981, 1981, 1985,
1993, 1999
),
time = c(
254.4, 252.6, 250.4, 249.2, 247.6, 246.8, 246.4, 246.2, 246.2,
244.6, 242.6, 241.6, 241.4, 239.4, 238.0, 237.2, 234.5, 234.4,
234.1, 233.6, 231.3, 231.1, 231.0, 229.4, 229.0, 228.8, 228.53,
228.40, 227.33, 226.32, 224.39, 223.13
)
)
c0 <- if (center == "mean") mean(mile$year) else center
3fit <- lm(time ~ I(year - c0), data = mile)
print(round(summary(fit)$coefficients[, 1:2], 3))
cat("The intercept is the record time in the year ", round(c0), "\n",
sep = ""
)
4plot(mile$year, mile$time,
pch = 19, xlab = "Year",
ylab = "World record, mile (seconds)"
)
abline(
a = coef(fit)[1] - coef(fit)[2] * c0, b = coef(fit)[2],
col = "#2166ac", lwd = 2
)- 1
- The page’s control: where to center the year, at 0, at 1950 or at the mean. There is no seed: the data are real.
- 2
- Men’s world records in the mile, 1913 to 1999.
- 3
- The regression on the centered year. Uncentered, the intercept is the predicted record in the year Jesus was born, a number nobody wants.
- 4
- The records with the fitted line.
# The year Jesus was born: center your predictors.
import numpy as np
import matplotlib.pyplot as plt
center = 0 # 0 (no centering), 1950, or "mean"
# Deterministic: no random numbers. Men's world records in the mile,
# 1913-1999, in seconds.
year = np.array([1913, 1915, 1923, 1931, 1933, 1934, 1937, 1942, 1942, 1942,
1943, 1944, 1945, 1954, 1954, 1957, 1958, 1962, 1964, 1965,
1966, 1967, 1975, 1975, 1979, 1980, 1981, 1981, 1981, 1985,
1993, 1999])
time = np.array([254.4, 252.6, 250.4, 249.2, 247.6, 246.8, 246.4, 246.2,
246.2, 244.6, 242.6, 241.6, 241.4, 239.4, 238.0, 237.2,
234.5, 234.4, 234.1, 233.6, 231.3, 231.1, 231.0, 229.4,
229.0, 228.8, 228.53, 228.40, 227.33, 226.32, 224.39,
223.13])
c0 = year.mean() if center == "mean" else center
X = np.column_stack([np.ones(len(year)), year - c0])
beta, *_ = np.linalg.lstsq(X, time, rcond=None)
s2 = np.sum((time - X @ beta) ** 2) / (len(year) - 2)
se = np.sqrt(s2 * np.diag(np.linalg.inv(X.T @ X)))
print(f"Intercept: {beta[0]:.1f} (se {se[0]:.2f}), the record time in "
f"the year {c0:.0f}")
print(f"Slope: {beta[1]:.3f} seconds per year (se {se[1]:.3f})")
plt.scatter(year, time, color="black")
plt.plot(year, beta[0] + beta[1] * (year - c0), color="#2166ac",
linewidth=2)
plt.xlabel("Year")
plt.ylabel("World record, mile (seconds)")
plt.show()Key takeaways
- Coefficients are evaluated where the other predictors equal zero. Make zero meaningful.
- Center continuous predictors such as years, ages or incomes at a sensible reference value, and scale them to readable units.
- Centering changes interpretation, not predictions.
Source
- Andrew Gelman, What does Jesus have to do with linear regression? (2025).