Instant PDF download, name-and-email checkout. Complete Book Bundle: every Economics, Statistics, Mathematics, Econometrics and Research Methods book
Statistics

Residuals and Residual Plots: How to Check Whether a Linear Model Fits

Learn how to read a residual plot to check whether a linear model fits: residuals, patterns, curves and fans, with a worked braking-distance example.

In 30 seconds
  • A residual is observed minus predicted, \(e = y – \hat y\). A residual plot graphs the residuals against \(x\) (or against \(\hat y\)) to check whether a straight line is a suitable model.
  • Random scatter around zero, with no pattern and roughly even spread, means a linear model fits. A curve means the relationship is not linear; a fan shape means the spread is not constant.
  • In our braking case, the line \(\hat y = -17.15 + 0.912x\) has \(r = 0.988\), yet the residuals run +, then −, then + in a clear U-shape: a straight line is the wrong model.
  • The standard deviation of the residuals, \(s = \sqrt{\sum e^2/(n-2)}\), gives the typical size of a prediction error; here \(s \approx 3.7\) m.
  • Exam point: a high \(r\) does not prove a line is appropriate. Always justify “linear model is appropriate” by describing the residual plot: no pattern, scattered randomly about zero.

The case: is braking distance a straight-line function of speed?

A driving-school instructor is preparing a road-safety lesson. On a closed test track, the same car is braked hard from eight different speeds, and the braking distance (from the moment the brakes are applied to the moment the car stops) is measured:

Speed (km/h), \(x\)2030405060708090
Braking distance (m), \(y\)611172534455670

A student fits a least-squares line and gets \(r = 0.988\). “That’s nearly perfect,” he says, “so braking distance goes up by a fixed amount for every extra km/h.” He then uses the line to predict the braking distance at 100 km/h and gets about 74 m. (The figures are illustrative.)

Is he right? The correlation is very high, but correlation only tells you how closely points follow some line. It does not tell you whether a straight line is the right shape. The tool that answers that question is the residual plot.

The concept: residuals and what their pattern reveals

Once you have fitted a regression line \(\hat y = a + bx\), every data point has a residual: the vertical distance from the point to the line. A positive residual means the point is above the line (the model under-predicted); a negative residual means it is below (the model over-predicted). For a least-squares line, the residuals always add up to zero.[1]

The residuals are what the line failed to explain. If the line has captured the true pattern, what is left over should look like random noise: no trend, no curve, no change in spread. If the residuals show a pattern, the line has missed something systematic. A residual plot simply turns this idea into a picture: put \(x\) (or the predicted values \(\hat y\)) on the horizontal axis and the residuals on the vertical axis, with a horizontal line at zero.

Key termResidual plot: a scatterplot of the residuals \(e = y – \hat y\) against the explanatory variable \(x\) (or against the fitted values \(\hat y\)). If a linear model is appropriate, the points are scattered randomly above and below the zero line, with no obvious pattern and roughly constant spread.
\[ e_i = y_i – \hat y_i = y_i – (a + b x_i), \qquad s = \sqrt{\frac{\sum e_i^2}{n-2}} \]

Here \(y_i\) is the observed value for the \(i\)th point, \(\hat y_i\) is the value the line predicts at the same \(x_i\), and \(e_i\) is the residual. \(a\) and \(b\) are the intercept and slope of the least-squares line. \(s\), the standard deviation of the residuals, measures the typical size of a prediction error, in the same units as \(y\). We divide by \(n – 2\), not \(n\), because two quantities (the slope and the intercept) were estimated from the data.[2]

Statistics Made Simple textbook coverStatistics Made Simple explains residuals and residual plots with worked examples, diagrams and tables.Get the textbook · $12

There are four patterns to recognise in a residual plot:

  • Random scatter around zero, roughly even width: the linear model is appropriate.
  • A curve (U-shape or upside-down U): the relationship is non-linear. A transformation or a curved model is needed.
  • A fan (spread grows or shrinks with \(x\)): the variability of \(y\) is not constant, so predictions are more precise in some places than others.
  • One point far from the rest: an outlier in \(y\), worth checking for a recording error or an unusual case.

Why this method fits the case

The student’s problem is not calculating the line; it is deciding whether a line is the right model. A residual plot is the standard check because:

  • It magnifies departures from linearity. On the original scatterplot the braking points look almost straight. Removing the linear trend makes the leftover pattern easy to see.
  • It works with any amount of data. With eight points or eight thousand, the logic is the same.
  • It shows where the model fails. We learn not just that the line is wrong, but for which speeds it under- or over-predicts.
  • It is what examiners expect. “Is a linear model appropriate?” is answered from the residual plot, not from \(r\).

It is not enough on its own when:

  • The sample is very small (say four points). Almost any pattern, or none, can appear by chance.
  • You need to know whether the slope is statistically significant. That needs a t-test for the slope.
  • Data were collected over time. Then you should also plot residuals in time order, to check that one error does not lead to the next.

Setting it up

The least-squares line for the braking data uses \(n = 8\), \(\bar x = 55\), \(\bar y = 33\), \(S_{xx} = 4200\) and \(S_{xy} = 3830\). So \(b = 3830/4200 \approx 0.9119\) and \(a = 33 – 0.9119 \times 55 \approx -17.15\). The line is \(\hat y = -17.15 + 0.912x\). Now compute a predicted value and a residual for each speed:

Speed \(x\) (km/h)Observed \(y\) (m)Predicted \(\hat y\) (m)Residual \(e = y – \hat y\) (m)
2061.084.92
301110.200.80
401719.32−2.32
502528.44−3.44
603437.56−3.56
704546.68−1.68
805655.800.20
907064.925.08
Sum2642640

The residuals add to zero, as they must for a least-squares line. That is a useful arithmetic check.

Solving it

Worked example

Use the residuals in the table to decide whether a linear model is appropriate for braking distance against speed.

Step 1 Look at the signs in order of \(x\): +, +, −, −, −, −, +, +.
Step 2 The residuals are positive at low speeds, negative in the middle and positive again at high speeds. Plotted against speed, they form a U-shape.
Step 3 A systematic pattern means the line misses part of the relationship: it over-predicts in the middle and under-predicts at both ends.
Step 4 Context check: physics says braking distance grows roughly with the square of speed, so a curve is expected.

A linear model is not appropriate: the residual plot shows a clear curved pattern, even though \(r = 0.988\).

Worked example

Calculate the standard deviation of the residuals for the braking line and interpret it.

Step 1 Square the residuals: \(4.92^2 \approx 24.21\), \(0.80^2 \approx 0.64\), \(2.32^2 \approx 5.38\), \(3.44^2 \approx 11.83\), \(3.56^2 \approx 12.67\), \(1.68^2 \approx 2.82\), \(0.20^2 \approx 0.04\), \(5.08^2 \approx 25.81\).
Step 2 Sum: \(\sum e^2 \approx 83.40\) (using unrounded residuals).
Step 3 Divide by \(n – 2 = 6\): \(83.40/6 \approx 13.90\).
Step 4 Square root: \(s = \sqrt{13.90} \approx 3.73\) m.

When the line is used to predict braking distance, the predictions are typically off by about 3.7 m. But because the errors are patterned, they are not random: at the extremes the line is consistently too low.

Worked example

For comparison, a courier records delivery distance \(x\) (km) and journey time \(y\) (minutes) for six trips: (10, 22), (15, 30), (20, 37), (25, 47), (30, 53), (35, 62). The least-squares line is \(\hat y = 5.96 + 1.594x\). Find the residuals and judge the fit. (The figures are illustrative.)

Step 1 Predicted values: 21.90, 29.88, 37.85, 45.82, 53.79, 61.76.
Step 2 Residuals: 0.10, 0.12, −0.85, 1.18, −0.79, 0.24. They sum to zero.
Step 3 Signs: +, +, −, +, −, +. No run of one sign, no curve, no widening.
Step 4 \(\sum e^2 \approx 2.82\), so \(s = \sqrt{2.82/4} \approx 0.84\) minutes.

The residuals scatter randomly about zero and are small, so a linear model is appropriate; predictions are typically within about 1 minute.

Statistics Made Simple Practice Questions coverMake reading residual plots automatic with the Practice Questions book: 1,569 questions, all fully worked.Get 1,569 questions · $9

What the answer tells us

Figure 1 plots the eight braking residuals against speed. The U-shape is unmistakable: the line sits too high in the middle and too low at both ends.

Residuals from the straight-line fit (braking distance, metres)
Zero lineResidualsTrend in residuals
−6−4−20246102030405060708090100Speed (km/h), xResidual (m)+4.92+0.80−2.32−3.44−3.56−1.68+0.20+5.08too low at the ends, too high in the middle
Figure 1. Residuals from ŷ = −17.15 + 0.912x plotted against speed. They form a clear U-shape, so a straight line is not an appropriate model even though r = 0.988.

Why the high correlation misled the student. The braking points rise steadily, so a line captures most of their variation and \(r^2 \approx 0.977\). But “most of the variation” is not “the right shape”. The leftover 2.3% is not random noise; it is the curvature. The residual plot isolates exactly that part.

Consequences for prediction. At 100 km/h the line predicts about 74 m. Because the residuals at the top end are already large and positive, the true distance is very likely to be longer. A model that follows the curve does far better. For example, regressing \(\sqrt{y}\) on \(x\) gives residuals that scatter randomly about zero (all within ±0.04), and back-transforming its prediction at 100 km/h gives about 85 m. Using the straight line here would understate the danger of high speed by about 11 m. That is the practical cost of skipping the residual check.[3]

Reasonableness check. The residuals sum to zero. The largest residuals (about 5 m) are at the ends of the data, which is typical for a straight line fitted to a curve. And the context agrees: basic physics says braking distance is proportional to the square of speed, so doubling speed roughly quadruples it. That is a squared relationship, not a linear one.

Residuals against \(x\) or against \(\hat y\)? With one explanatory variable and a positive slope, both plots have the same shape; only the horizontal scale changes. With a negative slope, the plot against \(\hat y\) is the mirror image. Computer output usually shows residuals against fitted values, and that version generalises to models with several explanatory variables.[4]

Common mistakeConcluding “the linear model is appropriate because \(r\) is close to 1.” A strong correlation is compatible with a curved relationship, as the braking data show. The appropriateness of a linear model is judged from the residual plot.
Common mistakeGetting the sign of a residual the wrong way round. A residual is observed minus predicted, \(y – \hat y\). At 20 km/h the car took 6 m but the line predicted 1.08 m, so the residual is \(+4.92\) m: the point is above the line. Writing \(-4.92\) flips the whole plot and the interpretation.
Exam tipWhen asked whether a linear model is appropriate, write two things: what you see (“the residuals are randomly scattered above and below zero with no curved pattern” or “the residual plot shows a clear curved pattern”) and the conclusion (“so a linear model is / is not appropriate”). When asked to interpret one residual, say it in context: “the actual braking distance at 90 km/h was 5.08 m longer than the line predicted.”

For a full treatment of fitting lines and checking them, the Statistics Made Simple textbook explains residuals and residual plots with clear diagrams and worked examples. To practise calculating residuals, reading plots and writing the conclusions examiners want, try the Statistics Made Simple Practice Questions book.

Statistics Made Simple bundle coverMaster regression and model checking with both Statistics Made Simple books for $16.Both books · $16

Practice questions

Give answers to three significant figures where appropriate.

EasyQ1. The regression line of a student’s exam score on revision hours is \(\hat y = 12.5 + 0.8x\). A student who revised for 40 hours scored 47. Find and interpret the residual. Show worked answer
Predicted: \(\hat y = 12.5 + 0.8 \times 40 = 44.5\).
Residual: \(e = 47 – 44.5 = 2.5\).
The student scored 2.5 marks more than the line predicted for 40 hours of revision.
EasyQ2. Describe what each residual plot pattern suggests: (a) random scatter about zero; (b) a fan shape that widens to the right; (c) an upside-down U-shape. Show worked answer
(a) A linear model is appropriate.
(b) The spread of \(y\) increases as \(x\) increases, so predictions are less precise for larger \(x\).
(c) The relationship is curved (it levels off or bends down); a linear model is not appropriate.
MediumQ3. Data: \(x\) = 2, 4, 6, 8, 10 and \(y\) = 5, 9, 10, 14, 17. The least-squares line is \(\hat y = 2.3 + 1.45x\). Calculate all five residuals and comment on the residual plot. Show worked answer
Predicted: 5.2, 8.1, 11.0, 13.9, 16.8.
Residuals: \(-0.2\), \(0.9\), \(-1.0\), \(0.1\), \(0.2\). Sum \(= 0\) (check).
Signs −, +, −, +, + show no systematic pattern and the residuals are small, so a linear model appears appropriate.
MediumQ4. Using the residuals from Q3, calculate the standard deviation of the residuals \(s\) and interpret it. Show worked answer
\(\sum e^2 = 0.04 + 0.81 + 1.00 + 0.01 + 0.04 = 1.90\).
\(s = \sqrt{1.90/(5 – 2)} = \sqrt{0.6333} \approx 0.796\).
Predictions of \(y\) from the line are typically off by about 0.8 units.
ExamQ5. For six students, hours of extra tuition \(x\) and test score \(y\) were (1, 48), (2, 55), (3, 60), (4, 62), (5, 63), (6, 63). The least-squares line is \(\hat y = 48.4 + 2.886x\) and \(r = 0.906\). (a) Calculate the residuals. (b) Describe the residual plot and state whether a linear model is appropriate. (c) A teacher uses the line to predict the score after 7 hours. Find the prediction and comment on it. [7] Show worked answer
(a) Predicted: 51.29, 54.17, 57.06, 59.94, 62.83, 65.71. [1]
Residuals: \(-3.29\), \(0.83\), \(2.94\), \(2.06\), \(0.17\), \(-2.71\). [2]
(b) Negative, then positive, then negative: an upside-down U-shape. [1] The relationship is curved (scores level off), so a linear model is not appropriate, despite \(r = 0.906\). [1]
(c) \(\hat y = 48.4 + 2.886 \times 7 \approx 68.6\). [1] This is extrapolation and, since scores have levelled off at about 63, the line is likely to over-predict; the prediction is unreliable. [1]

Frequently asked questions

Why do the residuals always add up to zero?

Because the least-squares line passes through \((\bar x, \bar y)\), the positive and negative residuals exactly balance. If your residuals do not sum to zero (allowing for rounding), there is an arithmetic error somewhere.

Can I tell whether a model is good just from the size of the residuals?

Size and pattern answer different questions. Small residuals (a small \(s\)) mean predictions are precise. A random pattern means the model has the right shape. A good model needs both, and a model can have one without the other.

What should I do if the residual plot shows a curve?

Try a transformation, such as taking logarithms or square roots of one variable, and fit a line to the transformed data. Then check the new residual plot. If it shows random scatter, the transformed model is appropriate. Our regression post introduces the wider family of models.

How is the residual plot used in inference for regression?

Before carrying out a t-test or confidence interval for the slope, you must check the conditions: a linear relationship, roughly constant spread and roughly normal residuals. The residual plot checks the first two, and a histogram or dot plot of the residuals checks the third. See our hypothesis testing guide for the general framework.

References

  1. Illowsky, B. & Dean, S. (2023) Introductory Statistics 2e. Houston, TX: OpenStax. https://openstax.org/details/books/introductory-statistics-2e
  2. Starnes, D. S. & Tabor, J. The Practice of Statistics. New York: W. H. Freeman.
  3. NIST/SEMATECH. e-Handbook of Statistical Methods. National Institute of Standards and Technology. https://www.itl.nist.gov/div898/handbook/
  4. Moore, D. S., McCabe, G. P. & Craig, B. A. Introduction to the Practice of Statistics. New York: W. H. Freeman.
Statistics Made Simple Complete Bundle cover showing both the textbook and practice book
This topic has a full chapter in Statistics Made Simple, with 1,569 worked practice questions in the bundle.Statistics Made Simple Complete Bundle — Textbook + 1,569 Practice Questions
Get it for $16
E

The EconTutorials team writes clear, exam-focused lessons in economics and statistics for A-Level, IB, AP and university students, with more than 13 years of classroom teaching behind every guide and book in the Made Simple series.