When one number rises, does the other follow? Read the cloud, measure the link, draw the line, predict — and never confuse a partnership for a cause.
Until now every measurement stood alone — one pile of heights, one pile of scores. But the world comes paired: a student's study time and their grade, a day's temperature and the cones a truck sells, a person's height and their weight. The interesting question is no longer "where is the center?" but "do these two move together?" To answer it we plot the pairs as a cloud of dots, squeeze the cloud's tilt into a single number r between −1 and +1, then thread the best straight line through it to predict. One warning rides along the whole way: two things rising together is a partnership, never a proof of cause.
A single variable gives you a list: x₁, x₂, …, xₙ. Paired data gives you a list of couples — for each individual you record two numbers at once, (x, y). To see whether they move together, give each pair a home on the plane: walk right by its x, up by its y, and drop a dot. The picture is a scatter plot, and its overall drift — not any single dot — tells the story.
The horizontal axis carries the variable we treat as the input (the explanatory variable, often what we can dial or know first); the vertical axis carries the response we want to predict. The same plane you met in Stage 21 · Linear functions now holds messy real data instead of one tidy rule.
A scatter plot turns a list of pairs (x, y) into a cloud of dots. We read its shape and tilt, not the individual dots: does the cloud rise, fall, or just sprawl?
Stand back from the cloud and ask what it does as your eye travels left to right.
"Tends to" is the honest phrase. A few dots can buck the trend; correlation describes the crowd's behaviour, not a promise about any one point.
Direction is the sign of the tilt: rising = positive, falling = negative, flat-and-fuzzy = none. Strength is how tightly the dots hug a line. We are about to measure both with one number.
"Rises a lot" and "rises a little" are too vague to compare. Karl Pearson's correlation coefficient r squeezes the whole cloud into a single number that lives between −1 and +1:
So r = +0.97 is a strong upward line, r = −0.97 an equally strong downward one, and r = 0.1 is barely a whisper of a trend. The engine computes it with GX.corr(pairs); you never read r off the picture.
For the strong-rising gallery set, GX.corr returns r = 0.999 — the dots barely leave the line. Knock one point far off and recompute: the cloud is the same shape, but r can collapse toward 0.40. A single stray point swings r hard — keep that in your pocket for §34.6.7.
r measures linear strength only. A cloud shaped like a perfect parabola — falling, bottoming out, then rising in a flawless ∪ — has a rock-solid relationship, yet r ≈ 0 because no single straight line fits it. A small r means "no line," not "no pattern." Always look at the cloud first.
If the cloud really does follow a line, which line? Among the infinitely many straight lines you could draw, statisticians pick the one that sits as close as possible to the dots. We write it
ŷ = b̂ x + â
The hat on ŷ ("y-hat") flags it as a prediction, not the real measured y. The slope b̂ says how much ŷ climbs per one-unit step in x; the intercept â is where the line crosses x = 0. The engine finds both from the data with GX.linReg(pairs), returning {b, a, r, predict}.
One beautiful fact pins the line down: it always passes through the cloud's centre of mass, the point (x̄, ȳ) — the average x paired with the average y. So the line is a see-saw balanced exactly on the means.
Why that line and not some other? For a candidate line, drop a vertical from each dot to the line. That gap is the line's residual at that point — how far the line missed. Some misses are above (positive), some below (negative); if we just added them, ups and downs would cancel and even a terrible line could score zero.
So we square each residual (killing the sign and punishing big misses extra), then add them up. That total is the sum of squared residuals, the SSE:
SSE = Σ (yᵢ − ŷᵢ)²
The least-squares line is, by definition, the one line that makes this total as small as it can be. Tilt away from it in either direction and the SSE climbs. That single rule — minimise Σ residual² — is what makes the fit fair and unique.
For the ice-cream data GX.linReg gives b̂ ≈ 3.10 with SSE = 130.5. Hold the line on the pivot and step half a unit either side of the best slope. Steepen it to b̂ + 0.5 ≈ 3.60: SSE jumps to 172.5. Flatten it to b̂ − 0.5 ≈ 2.60: SSE is again 172.5. Because the two slopes sit the same distance from b̂, the total climbs equally on either side — the bowl bottoms out exactly at b̂ ≈ 3.10.
A fitted line earns its keep by predicting. Feed it an x and read off ŷ = reg.predict(x). For the ice-cream line ŷ = 3.10x − 41.57, a 31 °C day predicts ŷ = 3.10·31 − 41.57 ≈ 54 dozen cones.
The residual y − ŷ measures the line's miss on a point we actually observed: small residuals mean a faithful line. But there is a cliff. The line was learned from data spanning, say, 20 °C to 34 °C. Predicting inside that range (interpolation) is reasonable; predicting far outside it (extrapolation) is a leap of faith — the straight-line pattern may not hold there at all.
Push the ice-cream line to x = 45 °C and it cheerfully predicts ever-more cones — but at scorching heat people stay home and sales would fall. The line knows nothing beyond the data it saw. Never trust a prediction far outside the observed range.
Here is the trap that has fooled scientists, journalists, and entire governments. Ice-cream sales and drowning deaths rise together across the year — a strong positive correlation. Does buying a cone make you drown? Of course not. A third, hidden actor — summer heat — drives both: hot days sell cones and send crowds into the water. That hidden actor is a lurking variable.
Correlation only says two variables move together. It cannot tell you whether x causes y, y causes x, or a lurking variable causes both. Proving cause needs a controlled experiment, not a scatter plot. The data shows a partnership; only careful reasoning can name a culprit.
① Correlation ≠ causation — a lurking variable may drive both. ② r measures only linear strength — a perfect parabola scores r ≈ 0. ③ One outlier can swing both r and the line. ④ Don't extrapolate far past the data. Read all four before you trust a line.
| Idea | What it does | From the engine |
|---|---|---|
| Scatter plot | Pairs (x, y) as a cloud; read its tilt | P.scatter(pairs) |
| Correlation r ∈ [−1, 1] | Sign = direction, |r| = linear strength | GX.corr(pairs) |
| Regression line ŷ = b̂x + â | Best line; passes through (x̄, ȳ) | GX.linReg(pairs) |
| Least squares | Minimises Σ(y − ŷ)² (the SSE) | the definition of b̂, â |
| Prediction & residual | ŷ = predict(x); miss = y − ŷ | reg.predict(x) |
| Causation | NOT implied — beware lurking variables | needs an experiment |
A scatter plot of cars' age (years) against resale price ($) drifts steadily down to the right. Describe the correlation in words, and predict the sign of r.
The cloud falls as age rises, so it is a negative correlation: older cars are worth less. Because the dots hug a falling line fairly tightly, r will be negative and fairly close to −1 (e.g. around −0.9).
A regression on study data gives ŷ = 5.29x + 46.46, where x is hours studied and ŷ is exam score. Interpret the slope and the intercept in plain words.
Slope b̂ = 5.29: each extra hour of study is associated with about 5.3 more points on the exam. Intercept â = 46.46: a student who studied 0 hours is predicted to score about 46 — and since x = 0 is at the edge of the data, treat that figure with caution.
For the same line ŷ = 5.29x + 46.46, predict the score for a student who studies 6 hours. If she actually scored 79, find the residual.
ŷ = 5.29·6 + 46.46 = 31.74 + 46.46 = 78.2. Residual = y − ŷ = 79 − 78.2 = +0.8 — the line missed low by 0.8 of a point, a tiny, faithful miss.
A study finds a strong positive correlation between the number of firefighters sent to a blaze and the damage done. Should the town send fewer firefighters? Name the lurking variable.
No — that confuses correlation with causation. The lurking variable is the size of the fire: a big blaze causes both more firefighters to be sent and more damage. Cutting firefighters would make damage worse, not better.
Two students fit lines to the same eight points. Ayra's line has SSE = 130, Ben's has SSE = 172, and the true least-squares SSE is 130. Whose line is the regression line, and what does that tell you about Ben's?
Ayra's line is the least-squares regression line — its SSE equals the minimum, 130. Ben's larger SSE = 172 means his line tilts away from the best fit; the least-squares line is the unique one with the smallest possible Σ(y − ŷ)².
A cloud of points falls, bottoms out, then rises in a clean ∪-shape (a parabola). Its correlation comes out as r ≈ 0. Is there "no relationship"? Explain.
There is a strong relationship — just not a linear one. r measures only how well a straight line fits, and no straight line follows a ∪. So r ≈ 0 means "no line," not "no pattern." Always look at the scatter plot, not r alone.
Six questions to lock it in. Tap the answer you think is right.
This lesson covers the bivariate-data strand of the Common Core: HSS-ID.B.6 (represent paired data on a scatter plot and fit a function — here the least-squares line — assessing the fit by residuals), HSS-ID.C.7 (interpret the slope and intercept of a linear model in context), HSS-ID.C.8 (compute and interpret the correlation coefficient r), and HSS-ID.C.9 (distinguish correlation from causation). Every statistic the page quotes — the slope, intercept, r, predictions, and residuals — is computed by the shared GX.linReg / GX.corr helpers, never read off a picture; the regression line in every figure is genuine least squares passing through (x̄, ȳ). It builds on Stage 21 (linear functions) and Stage 33 (the normal curve and expectation), and the "reaching a verdict from data" mindset carries on into Stage 34.7's chi-square test and the logic of Stage 35.