Correlation

Do taller people really weigh more? Does an extra hour of revision nudge up your marks? Whenever you suspect two things rise or fall together, correlation puts a single number on exactly how tightly they are linked — the kind of number that fills sports analytics, medical studies and market research.

A scatter plot shows you a relationship; the correlation coefficient r puts a single number on it. It squeezes the whole question "how tightly do these two variables move together?" into one value between -1 and +1 — where +1 is a perfect upward line, -1 a perfect downward line, and 0 no linear relationship at all.

That is enormously useful — one number you can compare, rank, and report. It is also, as you will see, one number that can lie to you spectacularly if you never looked at the scatter first. Both things are true, and that tension is the whole story of this page.

Sign and magnitude

r lives in

-1 \le r \le 1,

and measures the strength and direction of the linear relationship between two variables.

So r = 1 and r = -1 are perfect straight lines (up and down); r = 0 is no linear trend at all. Read the two halves separately — sign tells you which way, magnitude tells you how tightly — and you can decode any reported r.

Where the number comes from

Standardise each variable into z-scores — subtract the mean and divide by the standard deviation — so both axes are measured in the same unitless scale. Then r is simply the average product of the paired z-scores:

r = \frac{1}{n}\sum_{i=1}^{n} z_{x_i}\, z_{y_i}, \qquad z_{x_i} = \frac{x_i - \bar x}{s_x},\quad z_{y_i} = \frac{y_i - \bar y}{s_y}.

Read the sign off the products: a point that is above average in both x and y contributes (+)(+) > 0; below average in both gives (-)(-) > 0. Points that match this way push r up; points that disagree (high x, low y) pull it down. When agreements and disagreements cancel, r \approx 0.

Loosen the cloud

Each dot starts on the perfect line y = x and is then nudged off it by a fixed amount times the noise dial. With no noise the points are collinear and r = 1; as you add noise the cloud fattens and r slides toward 0. The live readout recomputes r from the points on screen.

Three worked reads

You rarely compute r by hand — you interpret one someone hands you. Here is how to talk about three of them.

1. Estimating from a picture. A scatter of study-hours versus exam-score rises clearly to the right and the dots sit fairly close to a straight line, with a little scatter. That is a strong positive linear cloud, so a sensible estimate is around r \approx 0.8. Not 1 (the dots aren't perfectly collinear), but comfortably strong and positive.

2. Reading a reported value. A study reports r = 0.8: strong and positive — the two variables rise together and the cloud is tight. Compare r = -0.3: the sign says the relationship is negative (one falls as the other rises), but the small magnitude says it is weak — a loose, barely-tilted blob. Sign and magnitude, read separately, every time.

3. When a perfect relationship gives r \approx 0. Take y = x^2 with x symmetric around zero — a perfect, fully predictable parabola. Compute r and you get roughly 0: the rising right half and falling left half contribute opposite-sign products that cancel. The relationship is flawless, yet r is blind to it, because r only measures linear association. So r = 0 means "no line", never "no relationship".

This is the single most important warning in all of statistics: correlation is not causation.

Ice-cream sales and drowning deaths are strongly correlated — both climb in summer — but neither causes the other. A lurking variable, the hot weather, drives both. A high |r| means only that two things move together; it says nothing about why. Confusing the two underlies a staggering number of bogus health claims, policy blunders, and "X causes Y" headlines. Before you believe any "X causes Y", ask: could a third variable drive both? Could it be pure coincidence? Could the arrow point the other way? A tight correlation is a question, not an answer.

A gleeful website called Spurious Correlations collects pairs of totally unrelated things that happen to track each other almost perfectly. US per-capita cheese consumption marches in near-lockstep with the number of people who died tangled in their bedsheets. The number of Nicolas Cage films released each year rises and falls with the number of swimming-pool drownings. These correlations are enormous — and utterly meaningless.

The lesson isn't magic, it's arithmetic: rummage through enough variables and some pairs will line up sky-high purely by chance. It also highlights a real distinction. Correlation is symmetric — it just says "these two move together", with no direction. When you instead want an asymmetric "use x to predict y", you need a regression line, which treats the two variables quite differently.

The one-line summary

See it explained