Residuals
Computing One Residual
The regression line for hours studied ($x$) and test score ($y$) is $\hat{y} = 5x + 50$. Mia studied $4$ hours and scored $72$. Find her residual.
Find the predicted score: $\hat{y} = 5(4) + 50 = 20 + 50$ = $\hat{y} = 70$
Subtract: observed minus predicted: $e = y - \hat{y} = 72 - 70$ = $e = 2$
Interpret the sign: $e > 0$, so Mia's point lies above the line = She scored 2 points more than predicted
Answer: Mia's residual is $2$: she scored 2 points higher than the line predicted, so her point is above the line.
A Negative Residual
With the same line $\hat{y} = 5x + 50$, Leo studied $3$ hours and scored $62$. Find his residual and say what it means.
Find the predicted score: $\hat{y} = 5(3) + 50 = 15 + 50$ = $\hat{y} = 65$
Subtract: observed minus predicted: $e = 62 - 65$ = $e = -3$
Interpret the sign: $e < 0$, so Leo's point lies below the line = The line overestimated his score by 3
Answer: Leo's residual is $-3$: his point is 3 points below the line, so the line predicted too much for him.
A Residual Table
Six students gave this data (hours studied, test score): $(1, 57)$, $(2, 58)$, $(3, 62)$, $(4, 72)$, $(5, 78)$, $(6, 78)$. The least-squares line is $\hat{y} = 5x + 50$. Make a table of the residuals and add them up.
Compute the predicted value for each x: $\hat{y} = 55, 60, 65, 70, 75, 80$ = One prediction per student
Subtract each prediction from the observed score: | $x$ | $y$ | $\hat{y}$ | $e = y - \hat{y}$ | |---|---|---|---| | 1 | 57 | 55 | 2 | | 2 | 58 | 60 | -2 | | 3 | 62 | 65 | -3 | | 4 | 72 | 70 | 2 | | 5 | 78 | 75 | 3 | | 6 | 78 | 80 | -2 | = Residuals: $2, -2, -3, 2, 3, -2$
Add the residuals: $2 + (-2) + (-3) + 2 + 3 + (-2)$ = $\sum e = 0$
Answer: The residuals are $2, -2, -3, 2, 3, -2$ and they add up to $0$. That always happens with the least-squares line: the positive and negative misses cancel out.
Sum of Squared Residuals
For the same six students, compare the least-squares line $\hat{y} = 5x + 50$ with the line $\hat{y} = 5x + 51$ using the sum of squared residuals (SSR).
Square the residuals of the least-squares line: $2^2 + (-2)^2 + (-3)^2 + 2^2 + 3^2 + (-2)^2 = 4 + 4 + 9 + 4 + 9 + 4$ = $\text{SSR} = 34$
Find the residuals of the other line: Predictions $56, 61, 66, 71, 76, 81$, so residuals $1, -3, -4, 1, 2, -3$ = Their sum is $-6$, not $0$
Square and add them: $1 + 9 + 16 + 1 + 4 + 9$ = $\text{SSR} = 40$
Compare: $34 < 40$ = $\hat{y} = 5x + 50$ fits better
Answer: The least-squares line has $\text{SSR} = 34$, the other line $40$. No straight line can get below $34$ for this data: that is exactly what "least squares" means.
Reading a Residual Plot
An app had these downloads (in thousands) in months $1$ to $6$: $20, 24, 31, 41, 54, 70$. The least-squares line is $\hat{y} = 10x + 5$. Compute the residuals and decide whether a straight line is a good model.
Compute the predictions: $\hat{y} = 15, 25, 35, 45, 55, 65$ = One prediction per month
Compute the residuals: $20 - 15, 24 - 25, 31 - 35, 41 - 45, 54 - 55, 70 - 65$ = $5, -1, -4, -4, -1, 5$
Look at the pattern in the residual plot: Positive at both ends, negative in the middle = A U-shaped curve
Draw the conclusion: A curved pattern means the data bends away from the line = A straight line is not a good model
Answer: The residuals $5, -1, -4, -4, -1, 5$ form a U shape. The downloads grow faster and faster, so a curved model would fit better than a straight line, even though the residuals still add up to $0$.
Mistake: Computing predicted minus observed ($\hat{y} - y$)
Why: This flips every sign: points above the line would get negative residuals and points below would get positive ones.
Correct: Always use observed minus predicted: $e = y - \hat{y}$. Positive means above the line.
Mistake: Judging a line by the plain sum of its residuals
Why: For the least-squares line the sum is always $0$, even when the line fits badly, because positive and negative residuals cancel.
Correct: Square the residuals first and add them (SSR), or look at the residual plot.
Mistake: Thinking a curved residual plot is fine because the points are close to zero on average
Why: A clear curve (U shape, hill shape) means the data follows a bend that a straight line cannot follow.
Correct: A linear model fits only when the residual plot looks like random scatter around $0$ with no pattern.
Mistake: Forgetting the unit or the size of a residual
Why: A residual of $-3$ on a test score means 3 points, not 3%. Its size only makes sense in the unit of $y$.
Correct: Say it in context: "The line overestimated Leo's score by 3 points."
Delivery Time Estimates
Delivery apps predict the time for an order from the distance. After each delivery, the residual shows whether the estimate was too short or too long.
With $\hat{y} = 2x + 10$ minutes for $x$ km, a 5 km order is predicted to take $20$ minutes. If it took $18$ minutes, the residual is $18 - 20 = -2$.
Plant Growth Experiments
Biologists fit a line to plant height over time. A plant with a large negative residual may be lacking light or water.
With $\hat{y} = 1.5x + 4$ cm after $x$ weeks, a plant is expected to be $10$ cm tall after 4 weeks.
Sports Science Models
Coaches predict an athlete's jump height from training data and judge the model by its sum of squared residuals: the smaller, the better.
If a model misses by $3$ cm and $-3$ cm for two athletes, the residuals add to $0$, but the squared residuals add to $9 + 9 = 18$.
A residual is observed minus predicted: $e = y - \hat{y}$
A positive residual means the point is above the line, a negative one means it is below
Residuals have the same unit as $y$ and are easiest to organize in a table: $x$, $y$, $\hat{y}$, $e$
The residuals of the least-squares line always add up to $0$
A residual plot with random scatter around $0$ means a line fits; a curved pattern means it does not
The least-squares line is the line with the smallest sum of squared residuals
Q: Why is it called a residual?
A: "Residual" means "what is left over". It is the part of $y$ that the line does not explain: the value left over after you take away the prediction.
Q: Why do we square the residuals instead of just adding them?
A: Plain residuals cancel out (for the least-squares line their sum is always $0$). Squaring makes every miss count as positive and makes big misses count much more.
Q: Is a big residual a mistake?
A: Not necessarily. It just means the point does not follow the pattern well. Check the data for a typo, but real data can have unusual cases too.
Q: How is a residual plot different from a scatter plot?
A: A scatter plot shows $x$ against $y$. A residual plot shows $x$ against the residual $e$, so the regression line becomes the horizontal line $e = 0$ and any pattern the line missed is easy to see.
Residuals
1 / 14
Residuals
Learn what a residual is, how to compute residuals in a table, and how a residual plot shows whether a line fits the data.