Skip to main content

Correlation

Noise and evidence
Law or aphorism
Intermediate
It does not even imply correlation.
Published

November 9, 2026

Modified

November 13, 2026

Entry #70 in Andrew Gelman’s Handy Statistical Lexicon. Original discussion: Correlation does not even imply correlation.

Filed under Noise and evidence · Law or aphorism · Intermediate.

Related terms: Berkson’s paradox, collider bias, spurious correlation, selection.

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

What it is

Everyone knows that correlation does not imply causation. Gelman’s sharper point is that a correlation in your sample does not even imply a correlation in the population. A noisy small sample, a data-dependent choice of which variables to correlate, or a sample selected on some combination of the variables can all produce a correlation that isn’t there in the world.

Why it matters

Analysts jump from we found r = 0.4 straight to arguing about causal direction, skipping the step of asking whether the correlation is real. With small samples, many candidate variable pairs, or selected samples (who gets into the hospital, who applies to the program, who answers the survey), sample correlations can be pure artifacts. Arguing about the causal story of an artifact wastes everyone’s time.

How it works

Three ways to get a correlation that isn’t there:

  1. Noise. With \(n\) observations and true correlation 0, the sample correlation has sd of about \(1/\sqrt{n}\). With \(n = 20\), \(|r| > 0.44\) happens 5% of the time.
  2. Forking paths. Among \(k\) candidate pairs, the largest sample correlation is much bigger than a typical one.
  3. Selection (Berkson’s paradox). If units are included only when \(x + y\) is high, then \(x\) and \(y\) become negatively correlated in the sample even if they are independent in the population.

Simulated example

\(X\) and \(Y\) are independent in the population. Choose a sample size and a selection rule, and look at the correlations you’d report.

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

viewof n = Inputs.range([10, 500], {value: 25, step: 5, label: "Sample size"})
viewof selection = Inputs.toggle({label: "Only observe units with X + Y above a cutoff (Berkson)", value: false})
viewof k = Inputs.range([1, 50], {value: 20, step: 1, label: "Number of variable pairs examined"})
viewof seed = Inputs.range([1, 500], {value: 70, step: 1, label: "Random seed"})

corrs = {
  const r = rng(seed);
  const draw = () => {
    const pts = [];
    while (pts.length < n) { const x = r.normal(), y = r.normal(); if (!selection || x + y > 1) pts.push({x, y}); }
    return pts;
  };
  const samples = range(k).map(() => draw());
  const rs = samples.map(s => cor(s.map(d => d.x), s.map(d => d.y)));
  const best = rs.reduce((bi, v, i) => Math.abs(v) > Math.abs(rs[bi]) ? i : bi, 0);
  return {rs, best, pts: samples[best], rBest: rs[best]};
}

Plot.plot({
  ariaLabel: "Correlation: simulation chart",
  ariaDescription: "Horizontal axis: X. Vertical axis: Y. The chart updates with the controls above it, and the summary below the charts states the result in words.",
  height: 300,
  grid: true,
  x: {label: "X"},
  y: {label: "Y"},
  marks: [Plot.dot(corrs.pts, {x: "x", y: "y", fill: "#2166ac", r: 3}), Plot.linearRegressionY(corrs.pts, {x: "x", y: "y", stroke: "#d6604d"})]
})
# Correlation does not even imply correlation.
1n <- 25 # sample size
selection <- FALSE # only observe units with x + y > 1 (Berkson)
k <- 20 # number of variable pairs examined
2set.seed(70)

3draw <- function() { # x and y are independent in the population
  x <- rnorm(20 * n)
  y <- rnorm(20 * n)
4  keep <- if (selection) which(x + y > 1)[1:n] else 1:n
  data.frame(x = x[keep], y = y[keep])
}
samples <- replicate(k, draw(), simplify = FALSE)
r <- sapply(samples, function(d) cor(d$x, d$y))
5best <- which.max(abs(r))

cat(
  "True correlation: 0. Most striking of", k, "sample correlations:",
  round(r[best], 2), "\n"
)

6plot(samples[[best]],
  pch = 19, col = "#2166ac",
  main = paste("r =", round(r[best], 2))
)
abline(lm(y ~ x, data = samples[[best]]), col = "#d6604d", lwd = 2)
1
The page’s controls: the sample size, whether units are selected on x + y, and how many variable pairs are examined.
2
Fixes the random numbers so the run is reproducible.
3
One sample in which x and y are independent in the population.
4
Berkson’s selection: keeping only units with a high x + y builds in a negative sample correlation.
5
The forking path: of k pairs examined, report the most striking.
6
The chosen sample with its fitted line. Its correlation came from noise, selection or search, not from the population.
# Correlation does not even imply correlation.
import numpy as np
import matplotlib.pyplot as plt

n = 25            # sample size
selection = False  # only observe units with x + y > 1 (Berkson)
k = 20            # number of variable pairs examined
rng = np.random.default_rng(70)


def draw():
    """x and y are independent in the population."""
    x, y = rng.normal(size=20 * n), rng.normal(size=20 * n)
    keep = np.flatnonzero(x + y > 1)[:n] if selection else np.arange(n)
    return x[keep], y[keep]


samples = [draw() for _ in range(k)]
r = np.array([np.corrcoef(x, y)[0, 1] for x, y in samples])
best = np.argmax(np.abs(r))
print(f"True correlation: 0. Most striking of {k} sample correlations: "
      f"{r[best]:.2f}")

x, y = samples[best]
slope, intercept = np.polyfit(x, y, 1)
xs = np.linspace(x.min(), x.max(), 2)
plt.scatter(x, y, color="#2166ac")
plt.plot(xs, intercept + slope * xs, color="#d6604d", linewidth=2)
plt.title(f"r = {r[best]:.2f}")
plt.show()

Key takeaways

  • A sample correlation can come from noise, from choosing which pairs to look at, or from selection.
  • Selected samples can show strong correlations between variables that are independent in the population.
  • Check that the correlation is real before debating its causal interpretation.

Source

Back to top