Statistics 📈 Relationships & Regression

Correlation

One number, r, for how tightly two things move together in a straight line.

Intro StatisticsAP Statistics level
💡
The big idea: Correlation squeezes a whole scatterplot into a single number, r, that lives between -1 and +1. Its sign tells you the direction two variables move together; its distance from zero tells you how tightly the points hug a straight line. It is one of the most useful numbers in statistics, and one of the most misread, because it only ever measures a straight-line tie, and a tie between two things is not proof that one causes the other.
🎯 By the end, you'll be able to
  • Read a scatterplot for the direction and strength of a relationship
  • Interpret the correlation coefficient r as a number between -1 and +1
  • Connect the size of |r| to how tightly the points cluster around a line
  • Explain why r captures only LINEAR association and why it is not evidence of causation
📎 You should already know
  • Scatterplots and plotting ordered pairs (x, y)
  • Mean and standard deviation

Do these two things move together?

Start with a picture. A scatterplot puts one variable on the horizontal axis and another on the vertical axis, then drops a dot for every pair of measurements: a person's height and weight, hours studied and quiz score, a car's age and its resale price.

Once you see the cloud of dots, your eye is already asking two questions. First, is there a direction — as one variable goes up, does the other tend to go up too, or down? Second, how tight is the pattern — do the dots sit almost on a line, or are they scattered into a shapeless blob? Correlation is just a way to answer both questions with a single number.

🔑 What the correlation coefficient r means
The correlation coefficient r is a number between -1 and +1 that summarizes the straight-line relationship between two variables. The sign gives the direction: positive means they tend to rise together, negative means one falls as the other rises. The size (how far r is from 0) gives the strength: values near ±1 mean the points nearly form a line, and values near 0 mean there is little or no straight-line trend.

Reading the number

Think of r on a sliding scale:

  • r = +1: a perfect uphill line — every point sits exactly on a rising straight line.
  • r near +0.7: a clear uphill trend, but with scatter around it.
  • r near 0: no straight-line tendency; knowing x tells you almost nothing about y.
  • r near -0.7: a clear downhill trend with scatter.
  • r = -1: a perfect downhill line.

Two things worth fixing in your mind right away: strength is about the magnitude \( |r| \), not the sign, so r = -0.9 is a stronger relationship than r = +0.5. And r is a pure number — it has no units, so it does not matter whether height is in centimeters or inches.

\[ r = \dfrac{\operatorname{cov}(x,y)}{s_x \, s_y} \]
The intuition: r is the covariance of x and y (how they vary together) divided by the product of their individual standard deviations. Dividing out each variable's own spread is what forces r into the fixed range from -1 to +1.
\[ r = \dfrac{\sum (x_i-\bar{x})(y_i-\bar{y})}{\sqrt{\sum (x_i-\bar{x})^2}\;\sqrt{\sum (y_i-\bar{y})^2}} \]
The form you actually compute with. Each point contributes its x-deviation times its y-deviation; points where both are above their means (or both below) push r up, points where one is above and the other below push it down.
🎮 Interactive: dial in a correlation LIVE
Drag the Target r slider from -1 to +1 and watch the cloud tilt: near ±1 the points tighten onto the line, near 0 they scatter into a blob, and the sign flips the line's direction. The readout shows the Pearson r actually computed from the points you drew — with a limited sample it wobbles around your target. Change the sample size n and press Resample to see how a bigger sample settles closer to the target.
✨ Three quiet facts about r
1. No units. r is a bare number, so rescaling a variable (cm to inches, dollars to euros) leaves it unchanged. 2. Symmetric. The formula treats x and y identically, so the correlation of x with y equals the correlation of y with x — swapping the axes does nothing to r. 3. Standardized. Because each variable's spread is divided out, r can never escape the interval from -1 to +1, which is exactly what makes different data sets comparable on one scale.

The two traps

Correlation is powerful precisely because it is one tidy number — and that tidiness hides two traps.

Trap 1: r only sees straight lines. Consider points that form a perfect, symmetric U-shape (a parabola). There is an obvious, strong pattern — yet r comes out near 0, because there is no net uphill or downhill straight-line trend: the rising half and the falling half cancel. A small r means no linear relationship, not no relationship at all. Always look at the scatterplot, not just the number.

Trap 2: correlation is not causation. A strong r tells you two things move together; it says nothing about why. Ice-cream sales and swimming-pool accidents rise and fall together across the year, but neither causes the other — a lurking third variable, hot weather, drives both. Correlation can hint at a relationship worth investigating, but on its own it cannot establish that one variable causes the other.

⚠️ Small r does not mean no pattern; big r does not mean cause
Two habits keep you honest. First, always plot the data — a curved or clustered pattern can hide behind an r near 0. Second, never read a large r as a cause — a lurking variable, or pure coincidence, can produce a strong correlation between things that have nothing to do with each other.
📝 Worked example: Five students report hours studied x = 1, 2, 3, 4, 5 and quiz scores y = 2, 4, 5, 4, 5. Find the correlation r and say what it means.
  1. Means: \( \bar{x} = (1+2+3+4+5)/5 = 3 \) and \( \bar{y} = (2+4+5+4+5)/5 = 4 \).
  2. x-deviations \( (x_i-\bar{x}) \): -2, -1, 0, 1, 2. y-deviations \( (y_i-\bar{y}) \): -2, 0, 1, 0, 1.
  3. Sum of products \( \sum (x_i-\bar{x})(y_i-\bar{y}) = 4 + 0 + 0 + 0 + 2 = 6 \).
  4. Spreads: \( \sum (x_i-\bar{x})^2 = 10 \) and \( \sum (y_i-\bar{y})^2 = 6 \).
  5. Put it together: \( r = 6 / \sqrt{10 \times 6} = 6/\sqrt{60} \approx 0.77 \).
✓ r is about +0.77 — a fairly strong positive linear association: students who studied more tended to score higher. But with only five points, and knowing correlation is not causation, this is a hint to explore, not proof that studying raised the scores.

Check your understanding

1. Four studies report these correlations. Which shows the STRONGEST linear association?
Strength is the distance from 0, that is the magnitude |r| — the sign is only direction. |-0.95| = 0.95 is closest to 1, so it is the strongest.
2. A scatterplot shows a clear, tight U-shape (a parabola), and the computed r is about 0. This tells you that…
r measures only the straight-line part. A symmetric U-shape has no net uphill or downhill trend, so r is near 0 even though the points follow an obvious curve. Small r means no linear pattern, not no pattern.
3. Across many towns, monthly ice-cream sales and swimming-pool accidents have r = +0.8. The safest conclusion is that…
Correlation measures association, not cause. A lurking variable — hot summer weather — can push both up at once, so correlation alone cannot establish causation.
4. You plotted x versus y and found r = 0.65. A classmate plots the same data with the axes swapped (y versus x). Their r is…
r is symmetric in x and y — the formula treats both variables the same way — so swapping which one is on which axis leaves r unchanged.
✅ Key takeaways
  • A scatterplot shows the direction and tightness of the relationship between two variables; correlation r captures both in one number.
  • r lives between -1 and +1: the sign is the direction, and the distance from 0 (the magnitude |r|) is the strength.
  • r near ±1 means the points nearly form a straight line; r near 0 means little or no straight-line trend.
  • r has no units, is symmetric in x and y, and is unchanged by rescaling a variable.
  • r measures only LINEAR association — a strong curve like a parabola can give r near 0 — so always plot the data.
  • Correlation is not causation: a strong r can come from a lurking variable or coincidence.