On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Statistics & Probability · Grade 9-12

Residuals

A residual is the difference between an observed value and the value the regression line predicts for it: e=y−y^.

ei=yi−y^i

Quick Answer

A residual is the difference between an observed value and the value the regression line predicts for it: e=y−y^. Use it to see how far off the model is for one particular point and, by plotting all the residuals, to check whether a straight line suits the data at all. A positive residual means the point sits above the line (the model predicted too low); a negative one means it sits below. For a least-squares line the residuals always add up to zero.

Why This Matters

A regression line is only useful if its misses are small and patternless. Residuals measure each miss in real units, such as "4 kg heavier than predicted," which flags unusual cases like an underpriced house or a player outperforming his minutes. A residual plot also exposes a line of the wrong shape: a curved pattern means the predictions are off in a predictable, fixable way.

Intuitive Explanation

A line y^=−41+0.6x predicts weight in kg from height in cm. A person 170 cm tall is predicted to weigh −41+0.6(170)=61 kg. If they actually weigh 65 kg, the residual is 65−61=+4 kg: on the scatter plot, a vertical segment 4 units long from the line up to the point. Someone else of the same height who weighs 58 kg has a residual of −3 and sits 3 units below the line.

Order matters: always observed minus predicted. Positive means the model guessed too low; negative means too high. Because the least-squares line balances the points above it against those below, the residuals always sum to exactly zero, so their plain total says nothing about fit. To measure overall error, square them first; the least-squares line is the one that makes ∑ei2 as small as possible.

Plot each residual against x and look for a pattern. A shapeless band around zero means the line has captured the trend. A U-shape, with positive residuals at both ends and negative ones in the middle, means the data curve and a straight line is the wrong model, even if every residual is small. A fan that widens to the right means predictions grow less reliable as x grows.

A residual is not a deviation from the mean. The 65 kg person is 65−55=10 kg above the sample's mean weight of 55 kg, but only 4 kg above the prediction for their height. A deviation compares with the average of everyone; a residual compares with people of the same x.

Think of it like this. A residual is like the gap between a weather forecast and the actual temperature. Forecast 20 °C, actual 23 °C: the forecast was 3 degrees too low, a residual of +3. One gap says little, but a forecast that is too low every afternoon reveals a flaw in the model, just as a pattern in a residual plot does.

Core idea. A residual is how far one data point falls above or below the regression line: e=y−y^.


When to Use

Use residuals when a question asks how far a specific point is from its prediction, whether the model overpredicted or underpredicted, or whether a line is a good model, judged from a residual plot. Compute y−y^, observed minus predicted. If the question asks how far a value is from the overall average, that is a deviation from the mean, y−yˉ. If it asks for one number summarizing all the misses, use r2 or the standard deviation of the residuals.

Tip. Ask: Am I taking one point's actual value minus the line's predicted value to measure its individual miss?

How to Recognize It

Before computing or reading residuals, check what each point is compared with and whether the question is about one point, a typical miss, or the overall shape of the misses.

  1. Does the question compare a value with the overall average yˉ instead of with a prediction from a fitted line?

    If yes, the gap is a deviation from the mean, the building block of variance and standard deviation, not a residual. A residual always needs a fitted line and the point's own x.

  2. Does the point sit above the line?

    If yes, its residual is positive and the line underpredicted it; a point below the line has a negative residual and was overpredicted. If your sign comes out the other way, you probably subtracted in the wrong order.

  3. Is the question about a whole residual plot rather than one point?

    If yes, look at its shape: random scatter around zero means a line suits the data, a curve means a line is the wrong model, and a fan shape means the misses grow with x. One point's miss is just its own residual.

  4. Does the question ask how large a typical prediction error is, in the units of y?

    If yes, use the standard deviation of the residuals, s=∑(y−y^)2n−2. If it asks what fraction of the variation the line explains, use r2 instead.

Residuals compared with LSRL, r^2, and Deviation from the mean

All four rows involve the same data and the same line, so they get confused. Ask what is measured: one point's miss from the line (a residual), the line itself (LSRL), all the misses combined (r2), or one point's distance from yˉ (a deviation).

Residuals

Meaning
Use this when you need to measure how far a single observed point falls from its regression prediction or diagnose model fit.
Key test
Am I taking one point's actual value minus the line's predicted value to measure its individual miss?
Formula
ei=yi−y^i
Example
An LSRL is y^=−41+0.6x. A person is 170 cm tall and actually weighs 65 kg. Find the residual.

LSRL

Meaning
The fitted line itself, which residuals are measured FROM; residuals are the leftovers it minimizes.
Key test
Use when you need the prediction equation, not a point's error.
Formula
y^=a+bx
Example
The best-fit line through the cloud

r2

Meaning
Summarizes ALL residuals into one fraction of variation explained, not a single point's miss.
Key test
Use when reporting overall fit quality.
Formula
r2=1−SSresSStot
Example
85% of variation explained

Deviation from the mean

Meaning
Distance from yˉ (used in variance), not distance from the predicted y^.
Key test
Use when measuring spread around the mean, not regression error.
Formula
yi−yˉ
Example
How far a value is from the average

Formula & Notation

ei=yi−y^i
ei=yi−y^i where y^i=a+bxi; for LSRL, ∑i=1nei=0 and ∑i=1nxiei=0

How to read it: ei is the residual for the i-th observation. The sum of all residuals from a LSRL is always zero: ∑ei=0.

Worked Examples

Example 1 — Residual at a point

Easy

An LSRL is y^=−41+0.6x. A person is 170 cm tall and actually weighs 65 kg. Find the residual.
Show the steps and the answer
  1. Predict: y^=−41+0.6(170)=−41+102=61 kg.

    The residual compares the actual weight with what the line predicts for this height.

  2. Subtract in the order observed minus predicted: e=65−61=4 kg.

    Using y−y^ makes the sign carry meaning.

  3. Interpret: +4 means the point lies 4 kg above the line.

    The line underpredicted this person's weight by 4 kg.

Answer: Residual =+4 kg

Takeaway: Predict first, then take observed minus predicted; the sign tells you above or below the line.

Example 2 — Distance from the average

Standard

Instead you're asked how far the 65 kg person is from the sample mean weight of 55 kg. Is that a residual?
Show the steps and the answer
  1. Notice the reference value: the sample mean of 55 kg, not the line's prediction.

    A residual is measured from y^; this question is about yˉ.

  2. Subtract the mean: 65−55=10 kg.

    This is a deviation from the mean, the kind of difference used in variance and standard deviation.

  3. Compare with the residual: 10 kg from the mean, but only 4 kg from the prediction.

    Height accounts for 61−55=6 kg of this person's extra weight; the residual is the 4 kg the line leaves unexplained.

Answer: No — that's a deviation from the mean, +10

Takeaway: A deviation measures distance from the average of everyone; a residual measures distance from the prediction for this x.

Example 3 — Find the mistake: predicted minus observed

Application

A line predicts test score from hours studied: y^=52+4.8x. Jess studied 5 hours and scored 70. Sam writes: "Residual =y^−y=76−70=6, so Jess scored above the line." Find the mistake and correct it.
Show the steps and the answer
  1. Check the prediction: 52+4.8(5)=52+24=76.

    Sam's predicted value is right, so the error lies in the subtraction.

  2. Use observed minus predicted: e=70−76=−6.

    The standard order is y−y^; Sam reversed it, which flipped the sign.

  3. Interpret the sign: −6 means Jess's point lies 6 points below the line.

    She scored lower than the model predicted, the opposite of Sam's claim.

Answer: Residual =−6: Jess scored 6 points below the predicted 76.

Takeaway: Always compute y−y^; reversing it flips both the sign and the meaning.

Where You'll See It

  • Spotting a bargain house

    An appraiser's model predicts a house's price from its size. A house listed at $310,000 where the model predicts $350,000 has a residual of −40,000 dollars: it is priced below what its size suggests, so it may be a bargain or have a problem the model can't see.

  • Players who beat their minutes

    Sports analysts predict a player's points from minutes played. A player whose residuals are positive game after game scores more than his minutes would suggest, evidence of efficient play rather than simply more time on court.

  • A curved pattern in child growth

    Fit a straight line to a child's height from birth to age 10 and the residual plot bends: negative residuals at both ends and positive ones in the middle, because babies grow fastest and growth then slows. That pattern says a curved model is needed.

Common Mistakes

  1. The slip: Computing predicted minus observed

    Instead: the standard is observed minus predicted, y−y^.

  2. The slip: Expecting nonzero residuals to sum to something meaningful

    Instead: for an LSRL the residuals always sum to zero, so use squared residuals to measure total error.

  3. The slip: Ignoring a curved pattern in the residual plot

    Instead: a clear curve means a line is the wrong model, even if individual residuals are small.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. An LSRL is y^=20+2x. At x=5 the observed value is y=33. Find the residual.

    Hint: Find the predicted value first, then take observed minus predicted.

  2. A line y^=2+0.5x predicts plant height in cm after x days. On day 10 a plant is 5 cm tall. Find the residual and say what it means.

    Hint: Predict the height for day 10 first.

  3. For y^=10+3x, a point at x=4 has residual −1.5. What is its observed y?

    Hint: Observed equals predicted plus residual.

  4. An LSRL is fit to 5 points. Four residuals are 2, −1, 3 and −3. What is the fifth residual?

    Hint: What do all the residuals of a least squares line add up to?

  5. A runner's time is 52 s and the team average is 55 s. You are asked how far she is from the average, with no regression line involved. Residual or deviation from the mean?

    Hint: Is she being compared to a line's prediction or to yˉ?

  6. For y^=4+1.2x at x=10, the observed value is 13. Zoe writes: "Residual =16−13=3." Correct her work.

    Hint: Which comes first in a residual, observed or predicted?

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Why do the residuals from a least-squares line always add up to zero?

It comes from how the intercept is chosen. Because a=yˉ−bxˉa = \bar{y} - b\bar{x}, the sum of y−y^y - \hat{y} over all nn points is nyˉ−n(a+bxˉ)=nyˉ−nyˉ=0n\bar{y} - n(a + b\bar{x}) = n\bar{y} - n\bar{y} = 0. The points above the line and those below it balance exactly. That is why the overall size of the misses is measured with squared residuals, which cannot cancel.

If the residual plot shows a curve but r is 0.95, is the line still fine?

No. A high rr says the points follow a strong trend, not that the trend is straight. Data that curve gently, like savings growing with compound interest, can have rr above 0.95 while the residuals form a clear U shape. A U means the line overpredicts in the middle and underpredicts at both ends, so its predictions are off in a predictable way. A curved model fits better.

Is the point with the biggest residual always the one that matters most?

Not necessarily. A point far from the others in the xx direction can drag the line toward itself, so its own residual ends up small even though it changes the slope a lot; such a point is called influential. A point with a large residual but an ordinary xx value often barely moves the line. To check, refit the line without the point and see how much the slope changes.

Why look at a residual plot when the scatter plot already shows the data?

The residual plot removes the trend and magnifies what is left. In a scatter plot with a steep trend, a slight curve or a growing spread is hard to see, because every point looks close to the line. Plotting y−y^y - \hat{y} against xx flattens the line to zero, so any bend or fan stands out. It is like zooming in on the gaps the line leaves behind.

Learning Path

You need the Least Squares Regression Line first, since every residual is measured from its predictions. Residuals add a point-by-point view of error, the fact that they sum to zero, and the residual plot as a check on whether a line fits. Next, the Coefficient of Determination combines the squared residuals into the share of variation explained, and Inference for Regression uses their spread to judge the slope.

See Also