Correlation & Linear Regression
Drag the points and watch the best-fit line and correlation coefficient r respond. See exactly what “least squares” minimises — and why correlation isn’t causation.
Scatter two variables against each other and a story often appears: taller people tend to be heavier, more revision tends to mean higher marks. Correlation measures how tight that story is, and regression draws the best straight line through it.
What correlation measures
Correlation captures the strength and direction of a straight-line relationship between two variables. We summarise it in a single number, the correlation coefficient r, which always lands between −1 and +1.
The sign tells you the direction: positive r means y tends to rise as x rises; negative r means y tends to fall. The size tells you the strength: the closer |r| is to 1, the more tightly the points hug a straight line. An r of exactly ±1 means the points lie perfectly on a line; an r of 0 means no linear pattern at all.
r measures how “line-like” a cloud of points is — not how steep the line is.
See it: fit a line
Drag the points below and watch r respond in real time. Pull the cloud into a tight upward band and r races towards +1; scatter them into a shapeless blob and r collapses towards 0. Notice too that the gold line always pivots through the mean point (x̄, ȳ).
Text description ↓Hide text description ↑
An interactive scatter plot. Dragging points (or adding new ones) updates the least-squares regression line, its equation ŷ = mx + c, and the correlation coefficient r. The line always passes through the mean point (x̄, ȳ). Points forming a tight upward band give r near +1; a shapeless cloud gives r near 0.
The least-squares line
Of all the straight lines you could draw through a scatter, which is “best”? The regression line of y on x is defined as the one that makes the total squared vertical distance from the points to the line as small as possible. Those vertical gaps are called residuals— the error between each real y and the line’s prediction ŷ.
A useful fact falls out of the algebra: the least-squares line always passes through the mean point (x̄, ȳ). So even before you compute a gradient, you know one point the line must go through — a handy check.
Reading r — and its traps
Interpreting r sensibly is where marks are won and lost. Values near ±1 indicate a strong linear relationship, values near 0 a weak one or none. But r is a summary, and summaries hide things.
A single outliercan drag both the line and r a long way, flattering or wrecking an otherwise clear pattern — drag one point far off in the widget above and watch r lurch. And most important of all: a strong r tells you two variables move together, not that one causes the other. Correlation is not causation.
Common mistakes
Practice
Across a summer, a town’s daily ice-cream sales correlate strongly with the number of drownings that day. Explain why this does not mean ice cream causes drownings.
Show the answer ↓Hide the answer ↑
The correlation is real but not causal. A hidden third variable — hot weather— drives both: heat pushes ice-cream sales up and sends more people swimming, so more drownings occur. Neither variable causes the other; both respond to temperature. A textbook example that correlation is not causation.
Where next?
The natural sequel is r², the coefficient of determination: square the correlation and you get the fraction of the variation in y that the line actually explains.
Frequently asked questions
What does the correlation coefficient r tell you?+
What does the least-squares regression line minimise?+
Why is correlation not causation?+
Does the regression line always pass through the mean point?+
The ScholarsGate Statistics Team
Oxbridge & Russell Group maths & statistics tutors
Written and reviewed by ScholarsGate tutors who teach A-Level and undergraduate statistics. Every explainer is checked against the AQA, Edexcel and OCR specifications.
Keep exploring
Want a tutor to walk you through it?
Book a DBS-checked A-Level Statistics tutor for a 1-on-1 lesson — online or in person.
Find a A-Level Statistics tutor