๐Ÿ“– Contents Chapter 14 ยท Correlation & Regression
Statistics · Chapter 14

Correlation & Regression

Almost every interesting question in the world is a question about two things at once: does studying more raise a score, does a heavier dose lower a symptom, does price move with square footage. Correlation and regression are the two tools that answer those questions honestly. Correlation puts a single number on how tightly two quantitative variables track each other; regression draws the one straight line that fits the cloud of points better than any other line could, and lets you use it to predict. Neither tool requires you to be fast at arithmetic — every formula in this chapter is built from things you already know, means and standard deviations. What they do require is care in interpretation, because this is the corner of statistics where confident people say wrong things most often.

By the end of this chapter you can

  • Build and read a scatterplot, and describe a relationship by its form, direction, and strength.
  • Place the explanatory and response variables on the correct axes.
  • Compute the correlation coefficient r by hand from deviations, and interpret its size and sign correctly.
  • State the cautions on r — linearity only, outlier sensitivity, restricted range, and the fact that correlation is not causation.
  • Find the least-squares regression line, and explain exactly what quantity "least squares" makes smallest.
  • Interpret the slope and intercept in the units of the problem, without smuggling in a causal claim.
  • Compute residuals and r2, and read a residual plot for curvature, spread, and outliers.
  • Use the line to predict, and recognize when a prediction is illegitimate extrapolation.
  • State the assumptions behind inference on the slope, and phrase a p-value and a confidence interval correctly.

Section 1Scatterplots

A scatterplot of paired data showing a strong positive relationship between two variables
Reference. A scatterplot with a strong positive relationship — each dot is one individual measured on two variables. Source and licence: see the figure credits

One dot, one individual, two measurements

Everything up to this point in the book has described one variable at a time: the mean of a set of scores, the spread of a set of blood pressures. A scatterplot is the first graph that shows two quantitative variables measured on the same individuals. Each individual contributes a single dot, positioned by its two values. If you measure six students on hours studied and exam score, you get six dots — not twelve.

Which variable goes where is not arbitrary. The explanatory variable (also called the predictor, or x) goes on the horizontal axis; the response variable (the outcome, or y) goes on the vertical axis. The convention encodes a direction of interest: we are asking whether x helps us say something about y, not the reverse. Hours studied explains exam score far more naturally than exam score explains hours studied, so hours goes on the x-axis. When neither variable is obviously the explainer — a person's arm span and their height, say — the choice is yours, but you must make it before you draw, because the regression line in Section 3 depends on it.

Form, direction, strength — and then outliers

Describing a scatterplot is a disciplined habit, and the discipline is a fixed order of four questions.

Form asks what shape the cloud takes. Is it a straight band? A curve that bends? Two separate clusters? Or a formless blob with no shape at all? Form comes first because it decides whether the rest of this chapter even applies: correlation and least-squares regression are tools for linear form. Point them at a U-shaped cloud and they will hand you a number, and the number will be a lie.

Direction asks which way the band tilts. Positive means high x values tend to come with high y values — the cloud rises left to right. Negative means high x comes with low y, and the cloud falls. Note the word tend: direction is a statement about the general drift of the whole cloud, not a promise about any single pair of points.

Strength asks how tightly the points hug that form. A narrow, pencil-thin band is strong; a fat, fuzzy band is weak. Strength is about scatter around the pattern, not about how steep the pattern is. This is the single most common misreading of a scatterplot, and it is worth pausing on: a nearly flat band of points that lie almost exactly on a shallow line is a strong relationship with a small slope. A steep spray of widely scattered points is a weak relationship with a large slope. Steepness and tightness are different questions.

Outliers are the last question. An outlier in a scatterplot is a point that sits far from the overall pattern — and note that it need not be extreme in x alone or y alone. A student with an ordinary 5 hours of study and an ordinary 95 on the exam may be perfectly unremarkable on either variable by itself, yet fall well off the joint pattern. Only the two-variable picture reveals that.

QuestionWhat you are looking atVocabulary to use
FormThe shape of the cloudLinear, curved (nonlinear), clustered, no pattern
DirectionWhich way a linear pattern tiltsPositive, negative, or neither
StrengthHow tightly points hug the patternStrong, moderate, weak
OutliersPoints far from the overall patternOutlier; influential point (Section 4)

The data we will carry through this chapter

To keep the arithmetic honest, one small data set will run through the next four sections. Six students recorded their total study hours before an exam, and we recorded their exam score out of 100.

StudentABCDEF
Hours studied (x)2457810
Exam score (y)726970808394

Sketch it mentally, or on paper. The form is roughly linear. The direction is positive: the low-hours students sit low, the ten-hour student sits highest. The strength looks good but not perfect — student A studied only 2 hours and out-scored student B, who studied 4. That single crossing is exactly the kind of imperfection that keeps r below 1, and we will see it show up numerically in Section 2 and again as a residual in Section 4.

Draw the picture before you compute the number. A correlation coefficient is a one-number summary, and every one-number summary throws information away. The scatterplot is the only place you will ever see curvature, clusters, or a single point dragging the whole analysis around. Computing r without looking at the plot is like reporting a patient's average temperature without noticing they spiked to 104 once.
Interactive Shape a relationship, draw real samples from it, and learn to read a scatterplot in order โ€” form, direction, strength โ€” while a live-computed correlation shows exactly what that one number can and cannot see. Open full ↑
Key points
  • A scatterplot shows two quantitative variables on the same individuals; one dot per individual.
  • Explanatory variable on the horizontal axis, response on the vertical.
  • Describe every scatterplot in the same order: form, direction, strength, outliers.
  • Strength is not steepness. A shallow but tight band is a strong relationship; a steep but fuzzy one is weak.

Section 2The correlation coefficient

Anscombe's quartet: four very different scatterplots that share the same correlation and regression line
Reference. Anscombe's quartet — four data sets with nearly identical means, correlations, and regression lines but utterly different shapes. Source and licence: see the figure credits

What r actually measures

The correlation coefficient, written r (and formally the Pearson correlation), is a single number between −1 and +1 that measures the direction and strength of a straight-line relationship between two quantitative variables. Its sign gives the direction; its distance from zero gives the strength. An r of exactly +1 means every point lies precisely on an upward line, −1 means every point lies precisely on a downward line, and 0 means no linear tendency at all.

The formula looks intimidating until you see what it is doing:

r = Σ(x − x̄)(y − ȳ) ÷ √[ Σ(x − x̄)2 × Σ(y − ȳ)2 ]

Read the top first. For each individual we ask: was it above or below average on x, and above or below average on y? If both answers agree — above on both, or below on both — the product of the two deviations is positive. If they disagree, the product is negative. Adding those products across all individuals asks the whole data set to vote. A large positive total means agreement dominates. The denominator then rescales that total so it can never exceed 1 in size, which is what makes r comparable across studies and completely free of units.

An equivalent form makes the unit-free part obvious. If zx and zy are the standardized scores of the two variables, then

r = [ 1 ÷ (n − 1) ] × Σ zx zy

Correlation is nothing more than the average product of z-scores. That is also why r does not change if you convert inches to centimeters or dollars to euros: standardizing washes the units out.

Computing r, step by step

Take the six students. First the means: Σx = 2 + 4 + 5 + 7 + 8 + 10 = 36, so x̄ = 36 ÷ 6 = 6 hours. And Σy = 72 + 69 + 70 + 80 + 83 + 94 = 468, so ȳ = 468 ÷ 6 = 78 points. Now build the deviation table — this one table will serve us for the rest of the chapter.

xyx − x̄y − ȳ(x−x̄)(y−ȳ)(x−x̄)2(y−ȳ)2
272−4−6241636
469−2−918481
570−1−88164
78012214
8832510425
10944166416256
Sums: 364680012642466

Two built-in checks before going on: the raw columns must reproduce the means (36 ÷ 6 = 6 and 468 ÷ 6 = 78), and both deviation columns must sum to exactly 0. They do. Now substitute:

r = 126 ÷ √(42 × 466) = 126 ÷ √19,572 = 126 ÷ 139.90 = 0.9006

So r ≈ +0.90. Round to two decimals for reporting. The sign is positive, matching the upward tilt we saw. The magnitude, 0.90, is close to 1, confirming a strong linear relationship — strong, but not perfect, because of student A out-scoring student B.

If you prefer the z-score route, you would need the standard deviations: sx = √(42 ÷ 5) = √8.4 = 2.898 hours and sy = √(466 ÷ 5) = √93.2 = 9.654 points. Then r = 126 ÷ [5 × 2.898 × 9.654] = 126 ÷ 139.89 = 0.9006, the same answer. Keep sx and sy handy; Section 3 uses them.

Four cautions that matter more than the formula

1. r measures linear association only. Consider hours of sleep versus alertness: too little is bad, too much is groggy, and the relationship is an arch. Such data can produce an r very near zero while the two variables are in fact tightly related — just not in a straight line. r near 0 means "no linear pattern," never "no relationship."

2. r is not resistant. Because it is built from means and squared deviations, a single distant point can drag r dramatically up or down. This is the lesson of Anscombe's quartet in the figure above: four data sets that share essentially the same means, the same r, and the same regression line, yet look nothing alike — one is genuinely linear, one is a clean curve, one is a perfect line ruined by a single outlier, and one is a vertical stack plus one lone point that manufactures the entire correlation.

3. A restricted range shrinks r. If you compute the correlation between admission test scores and college grades using only the students who were admitted, you have thrown away the entire low end of the x range. Cutting the range of x mechanically reduces r, which is why selective samples routinely make good predictors look useless.

4. Correlation is not causation. This is the one everyone can recite and almost no one applies. A strong r between two variables is consistent with at least four different worlds: x causes y; y causes x; a third lurking variable causes both; or the pattern is coincidence in a small sample. Ice cream sales correlate with drowning deaths — because hot weather drives both. The correlation is real; the causal story is fiction. Only a randomized experiment, which breaks the link between the treatment and every lurking variable at once, licenses a causal claim from data like these.

Two smaller notes worth keeping. r requires both variables to be quantitative — there is no correlation between eye color and height. And r is symmetric: the correlation of x with y equals the correlation of y with x. That symmetry is a warning in itself, because it means r alone can never tell you which variable is doing the explaining.

Value of rWhat it saysWhat it does not say
r = +1Every point on one upward straight lineNothing about how steep that line is
r = +0.90Strong positive linear associationThat x causes y
r = −0.90Strong negative association — exactly as strong as +0.90That the relationship is "worse" than a positive one
r = 0.05Almost no linear tendencyThat the variables are unrelated — the form may be curved
r = −1.4Nothing — this is impossible— check your arithmetic; r lives in [−1, +1]
The sign and the size are two separate messages. Read r = −0.87 as two facts glued together: the direction is negative, and the strength is 0.87 — strong. A common exam error is calling −0.87 "weaker" than +0.60 because it is a smaller number. Strength is the distance from zero, so −0.87 is decisively the stronger of the two.
Interactive Drag points around a live scatterplot and watch the correlation coefficient r, the least-squares line, and rยฒ recompute in real time. Open full ↑
Key points
  • r measures the direction and strength of a linear relationship and always lies between −1 and +1.
  • r = 126 ÷ √(42 × 466) = 0.90 for our study-hours data — strong and positive.
  • r has no units, is unchanged by rescaling, and is symmetric in x and y.
  • r is not resistant to outliers, is blind to curvature, shrinks under a restricted range, and never establishes causation.

Section 3The regression line

A scatterplot with a fitted straight regression line drawn through the points
Reference. A least-squares regression line fitted through a cloud of points. Source and licence: see the figure credits

What "least squares" means

Once a scatterplot looks linear, you can lay a straight line through it and use that line as a model. But infinitely many lines pass through a cloud of points, so we need a rule that picks exactly one. The rule is least squares.

For any candidate line, and for each data point, measure the vertical distance from the point to the line — how far off the line's prediction was. That distance is the residual: residual = y − ŷ, where ŷ ("y-hat") is the value the line predicts. Square every residual so that misses above and below both count as errors and cannot cancel, then add them up. The least-squares regression line is the unique line that makes that sum, Σ(y − ŷ)2, as small as it can possibly be.

Two details in that definition are load-bearing. First, the distances are vertical, not perpendicular — because we are in the business of predicting y from x, and vertical distance is exactly the error in predicting y. Second, we square rather than take absolute values, which has the side effect of making a large miss count disproportionately. That is why one outlier can tilt a regression line so effectively.

An immediate consequence of squaring vertical distances: the regression line of y on x is not the same as the line of x on y. Correlation is symmetric; regression is not. Swap the roles of the variables and you get a different line, so decide which variable you are predicting before you fit anything.

Slope and intercept

Write the line in the familiar form ŷ = a + bx, where b is the slope and a the y-intercept. The least-squares solution is remarkably tidy:

b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)2   — equivalently    b = r × (sy ÷ sx)

a = ȳ − b x̄

The second slope formula is worth staring at. The slope is the correlation, converted from standardized units back into real ones by the ratio of the two standard deviations. It also tells you that the slope and r always share a sign: a positive correlation guarantees an upward line. And the intercept formula is a rearrangement of ȳ = a + bx̄, which says something useful in its own right: the least-squares line always passes through the point of averages (x̄, ȳ). If your line misses that point, you have made an arithmetic error.

Fitting the line to our data

Everything we need is already in the Section 2 table. The slope:

b = 126 ÷ 42 = 3

Check it the other way: b = r × sy ÷ sx = 0.9006 × (9.654 ÷ 2.898) = 0.9006 × 3.331 = 3.00. Agreed. Now the intercept:

a = ȳ − bx̄ = 78 − (3)(6) = 78 − 18 = 60

The least-squares line is ŷ = 60 + 3x. Verify the point of averages: at x = 6, ŷ = 60 + 18 = 78 = ȳ. Correct.

Interpreting the slope. The slope is a rate, and its units are the units of y per unit of x: 3 exam points per hour of study. State it as a prediction, not a promise: "for each additional hour studied, the model predicts an increase of about 3 points in exam score, on average." Not "an extra hour raises your score by 3 points" — that is a causal claim, and this is observational data, so a lurking variable such as prior preparation could be producing both.

Interpreting the intercept. The intercept is the predicted y when x = 0: a student who studies 0 hours is predicted to score 60. Sometimes that is meaningful, sometimes it is nonsense, and the deciding question is always whether x = 0 is inside the range of the data we actually observed. Our hours ran from 2 to 10, so x = 0 sits outside the data — close by, but outside. Treat that 60 as an anchor that positions the line, not as a real forecast about a student who never opens the book.

Proving the line is best

"Least squares" is a claim we can test with arithmetic. Our line gives the following predictions and errors: at x = 2, ŷ = 66 and the actual score was 72, an error of +6; at x = 4, ŷ = 72 versus 69, error −3; at x = 5, ŷ = 75 versus 70, error −5; at x = 7, ŷ = 81 versus 80, error −1; at x = 8, ŷ = 84 versus 83, error −1; at x = 10, ŷ = 90 versus 94, error +4. Squaring and adding: 36 + 9 + 25 + 1 + 1 + 16 = 88.

Now try a steeper line. Keep it through the point of averages — for any slope you fix, the intercept that minimizes the squared errors is a = ȳ − b x̄, so the best line at that slope always passes through (x̄, ȳ) — with slope 3.5, so a = 78 − 3.5(6) = 57 and ŷ = 57 + 3.5x. Its errors are +8, −2, −4.5, −1.5, −2, +2, and the squared total is 64 + 4 + 20.25 + 2.25 + 4 + 4 = 98.5. Worse. A shallower slope of 2.5 gives a = 63, errors +4, −4, −5.5, −0.5, 0, +6, and a squared total of 16 + 16 + 30.25 + 0.25 + 0 + 36 = 98.5. Also worse, and by exactly the same amount — the penalty for missing the best slope is symmetric.

Candidate lineSlopeInterceptΣ(y − ŷ)2Verdict
ŷ = 63 + 2.5x2.56398.5Too shallow
ŷ = 60 + 3x36088Least squares — the best line
ŷ = 57 + 3.5x3.55798.5Too steep

No other slope beats 88. That number has a name we will use throughout Section 4: the sum of squared errors, SSE.

Fit a line only after the scatterplot earns it. Least-squares arithmetic will happily fit a straight line to a perfect parabola and report a slope with a straight face. The formula has no way of knowing the form is wrong. That check is yours, made with your eyes, before you compute anything — and confirmed afterward with the residual plot in the next section.
Interactive Tilt and shift a line through a fixed cloud of points and watch the sum of squared residuals fall to its unique minimum, with each residual drawn as a literal square and a live SSR-vs-slope landscape. Open full ↑
Key points
  • The least-squares line minimizes Σ(y − ŷ)2, the sum of squared vertical distances.
  • b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)2 = r sy ÷ sx; and a = ȳ − b x̄.
  • Our line is ŷ = 60 + 3x: predicted score rises about 3 points per extra study hour.
  • The line always passes through (x̄, ȳ), and the slope always shares the sign of r.
  • Regression is not symmetric — predicting x from y gives a different line.

Section 4r-squared and residuals

A residual plot showing the residuals from a fitted regression line scattered about zero
Reference. A residual plot from an ordinary least-squares fit — residuals scattered about the zero line. Source and licence: see the figure credits

Residuals: what the line missed

A residual is the leftover: residual = observed − predicted = y − ŷ. A positive residual means the actual value sat above the line — the individual did better than the model expected. A negative residual means it sat below. The residuals are the raw material for everything in this section, so compute them carefully.

x (hours)y (actual)ŷ = 60 + 3xResidual y − ŷResidual2
27266+636
46972−39
57075−525
78081−11
88384−11
109490+416
Sums——088

The residuals sum to exactly zero. That is not luck — it is a mathematical guarantee of least squares, and therefore a free error check every time you do this by hand. Student A, who studied 2 hours and scored 72, has the largest residual: +6 points better than the model predicted. Student C, at 5 hours and 70 points, came in 5 points short.

r2: how much variation the line explains

Before we had a line, our only guess for any student's score would have been the overall mean, 78. The total variation in y around that mean is the total sum of squares, SST = Σ(y − ȳ)2 = 466, which we already computed in Section 2. After fitting the line, the variation still left over is SSE = Σ(y − ŷ)2 = 88. The line therefore accounted for 466 − 88 = 378 of the original variation.

The coefficient of determination is that accounted-for share:

r2 = 1 − (SSE ÷ SST) = 1 − (88 ÷ 466) = 1 − 0.1888 = 0.8112

And it lives up to its name: it really is the square of the correlation. From Section 2, r = 0.9006, and 0.90062 = 0.8111 — the same value up to rounding. So we report r2 = 0.81, or 81%.

The correct sentence is: about 81% of the variation in exam scores is explained by the linear relationship with hours studied. The remaining 19% is variation the line does not capture — sleep, prior knowledge, test anxiety, luck. Three phrasings that sound similar and are all wrong: it does not mean 81% of the points lie on the line; it does not mean predictions are 81% accurate; and it does not mean studying causes 81% of exam performance. r2 is a statement about variation, nothing else.

Because it is a square, r2 always falls between 0 and 1 and is always positive — which means it discards the direction of the relationship. Report r alongside it, or your reader cannot tell whether the association was positive or negative.

Reading a residual plot

A residual plot graphs the residuals on the vertical axis against x (or against ŷ) on the horizontal. Its whole purpose is to magnify what the original scatterplot hides. In the original plot, a gentle curve can be swamped by the steep overall rise; subtracting the line removes that rise and leaves the misfit standing alone.

What you want to see is nothing: a formless horizontal band of points scattered above and below the zero line, with no shape and roughly constant width. That is the residual plot's way of saying the straight-line model is adequate. Any structure is a message.

What the residual plot showsWhat it meansWhat to do
Formless horizontal band around zeroA line is an adequate modelProceed — report slope, r, r2
A clear U or arch (curvature)The true form is curved, not linearDo not use the line; transform a variable or fit a curve
A fan widening left to rightSpread of y grows with x (non-constant variance)Predictions are far less reliable at the wide end
One point far from the rest verticallyAn outlier in the y directionInvestigate it; report results with and without it
One point far out in x with a small residualA high-leverage, possibly influential pointRefit without it — if the line moves a lot, say so

Our six residuals, in x order, run +6, −3, −5, −1, −1, +4. They start high, dip negative in the middle, and come back up — a faint U. With only six points that is far too little evidence to abandon the linear model, but it is exactly the pattern you would flag and watch if you collected forty students instead of six.

The distinction in the last two table rows deserves emphasis. Leverage is about being extreme in x; a point far to the right or left of the other x values sits at the end of a long lever and can swing the line. Influence is about actually changing the answer: a point is influential if removing it noticeably moves the slope, the intercept, or r. High-leverage points are the ones most likely to become influential, but the only way to know is to refit without the point and compare.

A high r2 does not mean the model is right. Anscombe's curved data set and his outlier-driven data set both post a respectable r2 while being badly served by a straight line. r2 tells you how much variation the line soaked up; the residual plot tells you whether a line was the right shape in the first place. Always report both, and trust the residual plot when they disagree.
Interactive Split a variable's variation into the share the regression line explains (r-squared) and the share left over, then read a live residual plot across four scenarios to tell a good fit from a wrong-shaped line or growing spread. Open full ↑
Key points
  • Residual = observed − predicted = y − ŷ; residuals from a least-squares line always sum to 0.
  • SST = 466 (variation about ȳ), SSE = 88 (variation left after the line), so r2 = 1 − 88÷466 = 0.81.
  • Say it as: "81% of the variation in y is explained by the linear relationship with x" — not 81% of points, not 81% accurate, not 81% caused.
  • r2 is always positive, so it hides direction — report r too.
  • A good residual plot shows no pattern; curvature, fanning, or a lone stray point each mean something different.

Section 5Prediction

A regression line shown with prediction bands widening away from the center of the data
Reference. A fitted line with prediction bands — note how the bands widen away from the center of the observed data. Source and licence: see the figure credits

Using the line

Prediction is mechanical: put a value of x into the equation and read off ŷ. With ŷ = 60 + 3x, a student who studies 6 hours is predicted to score 60 + 3(6) = 78; a student who studies 9 hours is predicted to score 60 + 3(9) = 87.

What is not mechanical is knowing what that number means. The regression line predicts the average y for individuals with that x, not the value any one individual will get. Our own data prove the point: student E studied 8 hours, the line predicted 84, and the actual score was 83. Off by one. Student A studied 2 hours, the line predicted 66, and the actual was 72 — off by six. A prediction from a regression line is a center of gravity, not a guarantee.

You can quantify the typical miss. The standard error of the estimate measures the typical size of a residual:

se = √[ SSE ÷ (n − 2) ] = √(88 ÷ 4) = √22 = 4.69 points

We divide by n − 2 rather than n − 1 because fitting a line consumed two pieces of information — a slope and an intercept. Interpretation: individual scores fall about 4.7 points away from the regression line, on average. So the prediction of 87 for a nine-hour student is better read as "somewhere in the mid-to-high 80s, give or take five points or so," and a rough working range of ŷ ± 2se — roughly 78 to 96 — is a serviceable ballpark. It is only a ballpark: a proper prediction interval is wider than that near the edges of the data, which is exactly the flaring you see in the figure above.

Interpolation is safe; extrapolation is not

Interpolation means predicting at an x value inside the range you observed. Our hours ran from 2 to 10, so predicting for 6 hours is interpolation, and it rests on evidence: we watched what happened to students on both sides of 6.

Extrapolation means predicting outside that range, and it rests on an assumption you cannot check — that the straight-line pattern continues where you have no data. Very often it does not. Watch what our perfectly reasonable line does when pushed:

Hours (x)Prediction ŷ = 60 + 3xInside the data (2–10)?Verdict
369YesInterpolation — trustworthy
678YesInterpolation — trustworthy
987YesInterpolation — trustworthy
060No (just outside)The intercept — anchors the line, not a real forecast
15105NoImpossible — the exam is out of 100
25135NoAbsurd — the model has left reality behind

The line never warns you. It will happily return 135 for a 25-hour student, because a line is an infinite object and arithmetic has no common sense. The real relationship must flatten — scores are capped at 100, and past some point extra hours yield nothing or actively hurt through fatigue. Our data simply never visited that region, so our line knows nothing about it. Always state the range of x your model was built on, and refuse predictions outside it.

Four more habits before you predict

Do not predict backwards with the same line. Our line predicts score from hours. To predict hours from score you must refit with the roles reversed — that line has slope 126 ÷ 466 = 0.27, not 1 ÷ 3. Algebraically inverting a regression line gives the wrong answer.

Remember regression to the mean. Because the slope is r × sy ÷ sx and r is less than 1 in size, predictions are always pulled toward ȳ relative to how extreme x was. A student one full standard deviation above average in hours is predicted only r = 0.90 standard deviations above average in score. This is not a defect; it is a consequence of imperfect correlation, and it explains why exceptional performances tend to be followed by more ordinary ones without any cause at all.

Check the conditions before you trust any inference. The descriptive tools — r, the slope, r2 — only need a roughly linear scatterplot. But the moment you attach a p-value or a confidence interval to the slope, you are relying on a model, and that model has four stated assumptions. Linearity: the true relationship between x and y is a straight line — check the scatterplot and confirm with a patternless residual plot. Independence: the observations are independent of one another, which comes from how the data were collected, not from anything you can see in a plot. Constant variance: the spread of y about the line is the same across the range of x — the fanning row in the Section 4 table is exactly this condition failing. Approximate Normality: the residuals are roughly Normal about the line, checked with a histogram or Normal plot of the residuals. Our six students are far too few to check any of this convincingly, which is itself the honest report.

Be precise about uncertainty language. Regression output usually includes a test of whether the slope differs from zero, along with a p-value and a confidence interval. Three statements must be kept straight. First, a p-value is the probability of getting data at least this extreme if the true slope were zero — it is not the probability that the true slope is zero, and not the probability that your finding is wrong. Second, a large p-value means you fail to reject the hypothesis of zero slope; it does not let you accept that the slope is zero. Absence of evidence for a relationship is not evidence that there is none — a small sample can hide a real slope easily. Third, a 95% confidence interval for the slope describes the long-run behavior of the procedure: if you repeated the whole study many times, about 95% of the intervals constructed this way would contain the true slope. It does not mean there is a 95% chance the true slope lies inside the one interval in front of you — that interval either contains it or it does not.

Every prediction should come with three sentences. The value ("about 87 points"), the typical error ("individual scores fall roughly 4.7 points from the line"), and the range of validity ("this model was built on students studying 2 to 10 hours"). A prediction reported without its uncertainty and its boundaries is not a statistic — it is a guess wearing a decimal point.
Interactive Fit a least-squares line to childhood height data (ages 2โ€“9), then slide a prediction age from inside the data out to adulthood and watch the line โ€” trustworthy in range โ€” insist a grown adult should be over eleven feet tall; every prediction, error, and reality-check computes live against the true growth curve. Open full ↑
Key points
  • Substituting x into the line predicts the average y at that x, not any individual's value.
  • se = √[SSE ÷ (n−2)] = √22 = 4.69 — the typical distance of a point from the line.
  • Interpolation (inside the observed x range) is supported by data; extrapolation is not, and produced an impossible 105 at 15 hours.
  • To predict x from y, refit — do not invert the equation.
  • Inference about the slope assumes linearity, independence, constant variance, and roughly Normal residuals — state and check them.
  • A p-value is not the probability the null is true; failing to reject a zero slope is not accepting it; and a 95% CI describes the long-run procedure, not this one interval.

The chapter in one breath

  • A scatterplot shows two quantitative variables on the same individuals; describe it as form, direction, strength, outliers, with the explanatory variable on the x-axis.
  • r measures the direction and strength of a linear relationship, lies in [−1, +1], has no units, and is symmetric; for our data r = 126 ÷ √(42×466) = 0.90.
  • r is blind to curvature, vulnerable to outliers, shrunk by a restricted range, and silent about causation — a lurking variable can produce any correlation you like.
  • The least-squares line minimizes Σ(y−ŷ)2; b = r sy÷sx = 3 and a = ȳ − b x̄ = 60, giving ŷ = 60 + 3x, which passes through (6, 78).
  • The slope is a predicted rate of change (3 points per hour); the intercept is only meaningful if x = 0 sits within the data.
  • Residuals (y − ŷ) sum to zero and give SSE = 88; with SST = 466, r2 = 0.81 — 81% of the variation in scores is explained by the linear relationship with hours.
  • A residual plot should look like nothing at all; curvature, fanning, and stray points each diagnose a different failure that r2 alone would hide.
  • Interpolate freely, never extrapolate — our line predicts an impossible 105 at 15 hours — and report every prediction with its typical error se = 4.69 and its range of validity.
  • Inference on the slope assumes linearity, independence, constant variance, and roughly Normal residuals; a p-value is not the probability the null is true, failing to reject is not accepting, and a 95% CI is a claim about the procedure.

ReferenceWords worth knowing

A quick reference for the terms in this chapter — skim it now, or circle back whenever a word trips you up.

Coefficient of determination (r2)
The proportion of the variation in y explained by the linear relationship with x; equals 1 − SSE÷SST, and equals the square of r.
Correlation coefficient (r)
A unit-free number between −1 and +1 measuring the direction and strength of a straight-line relationship between two quantitative variables.
Explanatory variable
The variable used to explain or predict the other; plotted on the horizontal axis and denoted x. Also called the predictor or independent variable.
Extrapolation
Predicting at an x value outside the range of the observed data; unsupported by evidence and a common source of absurd results.
Fitted value (ŷ)
The value the regression line predicts for a given x; also called the predicted value.
Influential point
An observation whose removal noticeably changes the slope, intercept, or r. Usually a high-leverage point — one extreme in the x direction, sitting at the end of a long lever — but only refitting without it can confirm influence.
Intercept (a)
The predicted value of y when x = 0; computed as ȳ − b x̄ and meaningful only if x = 0 falls within the data.
Interpolation
Predicting at an x value inside the observed range; the legitimate use of a regression line.
Least-squares regression line
The unique line ŷ = a + bx that makes the sum of squared vertical distances from the points to the line as small as possible.
Lurking variable
A third variable, not measured, that affects both x and y and can create a correlation with no causal link between them.
Outlier
A point lying far from the overall pattern of the scatterplot; it need not be extreme on either variable alone.
Regression to the mean
The tendency for predicted y values to be less extreme than their x values, because the slope is r times sy÷sx and |r| is less than 1.
Residual
Observed minus predicted, y − ŷ; positive above the line, negative below, and always summing to zero for a least-squares fit.
Residual plot
A graph of residuals against x (or against ŷ); a good one shows no pattern at all.
Response variable
The outcome being explained or predicted; plotted on the vertical axis and denoted y. Also called the dependent variable.
Restricted range
A sample that covers only part of the possible x values, which mechanically shrinks r and hides a real relationship.
Scatterplot
A graph of two quantitative variables measured on the same individuals, one dot per individual.
Slope (b)
The predicted change in y for a one-unit increase in x; equals r × sy ÷ sx and always shares the sign of r.
Spurious correlation
A strong association between variables that have no causal connection, typically produced by a lurking variable or by chance.
Standard error of the estimate (se)
The typical size of a residual, √[SSE ÷ (n − 2)]; a root-mean-square measure of how far observed points fall from the line, divided by n − 2 because the fit consumed a slope and an intercept.
Sum of squared errors (SSE)
Σ(y − ŷ)2, the variation in y left unexplained after fitting the line.
Total sum of squares (SST)
Σ(y − ȳ)2, the total variation in y about its mean before any line is fitted.

Check yourself

1. A scatterplot of daily temperature (x) against heating cost (y) shows a tight band of points falling steadily from upper left to lower right, with one point far above the band. Describe the relationship in the four required terms.
Form: linear. Direction: negative. Strength: strong. Outliers: one point lies well above the pattern. Use that fixed order every time — form first, because if the form were curved, r and a least-squares line would both be inappropriate no matter how tight the band looked.
2. Two scatterplots are shown. Plot P has points scattered loosely around a very steep line; plot Q has points lying almost exactly on a nearly flat line. Which shows the stronger relationship, and why?
Plot Q. Strength is about how tightly points hug the pattern, not how steep the pattern is. Q's points barely deviate from its line, so Q has the larger |r|. P's steep slope tells you about the rate of change, which is a separate question from strength.
3. For a data set you compute Σ(x−x̄)(y−ȳ) = 60, Σ(x−x̄)2 = 40, and Σ(y−ȳ)2 = 250. Find r and interpret it.
r = 60 ÷ √(40 × 250) = 60 ÷ √10,000 = 60 ÷ 100 = 0.60. A moderate positive linear relationship: above-average x values tend to come with above-average y values, but with substantial scatter. Note that r2 = 0.36, so only 36% of the variation in y is explained.
4. A classmate says "r = −0.85 is a weaker relationship than r = +0.60 because −0.85 is a smaller number." Correct them.
Strength is the distance from zero, so −0.85 is decidedly the stronger relationship. The sign carries only the direction: −0.85 means a strong downward pattern. Sign and magnitude are two separate messages packed into one number.
5. Number of firefighters sent to a fire correlates strongly with the damage the fire causes. Should cities send fewer firefighters? Explain in the vocabulary of this chapter.
No — this is a lurking variable, not causation. The size of the fire drives both: big fires draw more firefighters and cause more damage. The correlation is genuine; the causal interpretation is false. Only a randomized experiment could support a causal claim, and no one would run that one.
6. A researcher measures hours of sleep and daytime alertness and reports r = 0.04, concluding the two are unrelated. What has been missed?
r near zero means no linear tendency, not no relationship. Alertness rises then falls with sleep — an arch. The upward half and downward half cancel in the numerator of r. A scatterplot would have shown the curve immediately, which is why you always plot before you compute.
7. Given x̄ = 50, ȳ = 200, sx = 10, sy = 30, and r = 0.60, find the least-squares regression line.
b = r sy ÷ sx = 0.60 × 30 ÷ 10 = 1.8; a = ȳ − b x̄ = 200 − 1.8(50) = 200 − 90 = 110. So ŷ = 110 + 1.8x. Check the point of averages: at x = 50, ŷ = 110 + 90 = 200 = ȳ. Correct.
8. Our chapter line is ŷ = 60 + 3x for exam score on hours studied. Write a correct interpretation of the slope, and explain what makes the tempting version wrong.
"For each additional hour studied, the model predicts an increase of about 3 points in exam score, on average." The tempting version — "studying one more hour raises your score by 3 points" — asserts causation from observational data. It also drops "on average," implying a guarantee for every individual, which residuals of +6 and −5 flatly contradict.
9. The same line has intercept 60. Is that a meaningful prediction? Why or why not?
Not really — the observed hours ran from 2 to 10, so x = 0 lies outside the data. The intercept is arithmetically necessary to position the line, but predicting a score of 60 for a student who studies zero hours is extrapolation. An intercept is a legitimate forecast only when x = 0 falls inside the observed range.
10. For our data r2 = 0.81. Which of these are correct interpretations? (a) 81% of the points lie on the line. (b) Predictions are 81% accurate. (c) 81% of the variation in exam scores is explained by the linear relationship with hours studied. (d) Studying causes 81% of exam performance.
Only (c). r2 = 1 − SSE÷SST = 1 − 88÷466 is a statement about variation. (a) confuses variation with point counts — in our data zero points lie exactly on the line. (b) invents an accuracy rate. (d) smuggles in causation, which no correlation can supply.
11. Student C studied 5 hours and scored 70. Compute the residual and state what its sign means. Then say what the six residuals must add to.
ŷ = 60 + 3(5) = 75; residual = 70 − 75 = −5. The negative sign means the actual score fell below the line — C did 5 points worse than the model predicted. All residuals from a least-squares line sum to exactly 0 (+6 − 3 − 5 − 1 − 1 + 4 = 0), which is a free arithmetic check.
12. A manager uses ŷ = 60 + 3x to argue that a student studying 20 hours would score 120. What is wrong, and what should the manager say instead?
This is extrapolation — 20 hours is double the largest observed value of 10, and the "prediction" of 120 exceeds the 100-point maximum, which alone proves the line has left reality. The correct statement: the model was built on students studying 2 to 10 hours and is only valid in that range; beyond it the relationship almost certainly flattens as scores approach their ceiling, and we have no data to describe that region.