Correlation Coefficient (r)
The correlation coefficient measures how tightly two variables move together — a single number from −1 to +1. The sign tells you the direction, the magnitude tells you the strength, and the whole thing is a famous trap for confusing "moves with" for "causes".
What it is
Pick two numeric columns — say height and weight, or ad spend and sales. The correlation coefficient, written r, collapses their relationship into one number between −1 and +1 that answers: as one variable goes up, how reliably does the other move in a straight line?
The most common version is Pearson's r. Its sign is the direction: positive means they rise together, negative means one falls as the other rises. Its magnitude is the strength: the closer |r| is to 1, the more tightly the points hug a straight line; the closer to 0, the more scattered. An r of exactly +1 or −1 means the points lie perfectly on a line.
The formula
Pearson's r is the covariance of x and y divided by the product of their standard deviations — covariance rescaled so it can't run off to infinity:
Σ (xᵢ − x̄)(yᵢ − ȳ)
r = ──────────────────────────────
√( Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² )
cov(x, y)
= ─────────────────
sₓ · s_y
The numerator measures how x and y vary together; the denominator standardizes by how much each varies on its own. That division is what bounds the result to −1 ≤ r ≤ +1 regardless of the units — correlate metres against kilograms or feet against pounds and you get the same number.
An r of 0 means no linear relationship — and only linear. Two variables can be locked in a perfect U-shaped curve and still report r ≈ 0, because the straight-line fit through them is flat. Correlation sees lines, not curves.
How to read it
| |r| | Rough reading |
|---|---|
|r| < 0.3 | Weak — barely a straight-line trend |
0.3 ≤ |r| < 0.7 | Moderate — a clear but loose relationship |
|r| ≥ 0.7 | Strong — points cluster close to a line |
These bands are conventions, not laws — a "moderate" 0.5 in a noisy field can be a major finding, while a "strong" 0.7 in physics might signal a problem. Read the sign first, the magnitude second, and the context always.
When the relationship is monotonic but not straight, or your data are ordinal (ranks, ratings), reach for Spearman's correlation instead. Spearman is just Pearson's r computed on the ranks of the data, so it captures any consistently-increasing or consistently-decreasing relationship — even a curved one — and shrugs off outliers that would yank a Pearson value around.
The causation trap
The single most-repeated warning in statistics is that correlation is not causation, and it earns the repetition. A strong r can arise from at least three innocent sources:
- A confounder. Ice-cream sales and drowning deaths correlate strongly — because hot weather drives both. Neither causes the other.
- Reverse causation. The arrow may point the other way from what you assume, or run in both directions at once.
- Coincidence. Sift enough variable pairs and some will correlate by pure chance, with no mechanism behind them at all.
And always plot the scatter before you trust the number. Anscombe's quartet is four datasets with the same r — one a clean line, one a curve, one a line dragged off by a single outlier, one nearly vertical. A coefficient with no picture behind it can hide all of these.
See also
- Related terms
- R-Squared · Effect Size · P-Value
- On the blog
- Pearson vs Spearman · Building a correlation matrix · Making a scatter plot
- In the app
- Run a correlation analysis and read the matrix
The correlation coefficient is a beautifully compact summary — and that compactness is exactly why it misleads. Pair every r with a scatter plot, ask what could be causing both variables, and treat a strong number as the start of an investigation, not the end of one.