Residual vs error: predicted vs true line
By Jude Wallis · Published
A residual is the observed value minus the value your fitted line predicts, so every data point has one you can compute. An error is the observed value minus the value on the true line, and nobody knows the true line, so an error is never observed. Residuals are what you get instead.
AP Statistics: Unit 5 (topics 5.4 Residuals, 5.5 Least-Squares Regression). Residuals are topic 5.4 and least-squares regression is topic 5.5 in Unit 5, Regression Analysis, of the Fall 2026 course; the exam asks for residuals as observed minus predicted, and the error is the unobservable quantity a residual estimates. Inference for the slope of a regression model is not part of this course.
Residual vs error: the short answer
Both are the same shape of quantity: an observed value minus a line. The difference is which line you subtract.
A residual subtracts the line you actually fitted. It is ("y minus y-hat"), observed minus predicted, and you can compute it for every point in your data set because you have the equation in front of you.
An error subtracts the true line, the one the data would follow if there were no scatter at all. Nobody has that line. It is a feature of the population, not of your sample, so with real data an error is never observed. Not by you, and not by the statistician who wrote the software.
That is the whole distinction, and everything below follows from it. A residual is computable and an error is not, because a residual is measured against a line you built and an error is measured against a line you can only estimate.
What a residual is
A residual belongs to one data point and one fitted line:
The order of the subtraction is fixed, and the sign carries the meaning. A positive residual puts the observation above the line, so the model underpredicted it. A negative residual puts it below, so the model overpredicted.
Suppose a line predicts a seedling will be 12 cm tall, so , and the seedling you measured is 14 cm. The residual is cm. The line missed low by 2 cm for that plant.
Because a residual is measured against a particular line, it changes when the line changes. Fit a different line to the same data and the residuals move, every one of them except at the single where the two lines cross. That is not a flaw; it is what makes residuals useful for judging a fit, which is the job of the residual plot. See also the residual entry for the sign conventions in one place.
What an error is
Write the true relationship as , where ("alpha") is the true intercept and ("beta") is the true slope. Then
The error for one observation is how far that observation fell from the true line. It exists. It is a real number. You simply cannot compute it, because and are unknown.
That is worth stating precisely, because students often assume errors are unobservable for some deeper reason. They are not. Hand someone the true and and every error in the data set becomes arithmetic. The problem is that nobody gets handed them. If you knew the true line you would have no reason to fit one.
One consequence: the only data sets whose errors you can see are the ones you made up. When you simulate data by choosing a line and adding scatter to it, you chose the errors, so you know them. The first worked example below does exactly that, and it is the only honest way to put a residual and an error side by side on the same page.
Residual vs error side by side
| Feature | Residual | Error |
|---|---|---|
| Subtracts | The fitted line | The true line |
| Formula | ||
| Can you compute it? | Yes, for every point | Not from real data; only in a simulation where you chose the true line |
| Comes from | Your sample | The population |
| Depends on the other data points | Yes, the fitted line is built from all of them | No, only on that point and the true line |
| Sum over your data set | Exactly zero for a least-squares fit | No constraint |
| Shows up on the AP exam | Yes, topic 5.4 | As the idea behind the word |
Read the table one row at a time and the pattern is the same each time: a residual is a sample quantity you hold, an error is a population quantity you do not.
Residuals estimate errors the way statistics estimate parameters
This is the sentence worth memorizing, because it puts residuals into a structure you already know from parameter vs statistic.
The fitted intercept estimates the true intercept . The fitted slope estimates the true slope . Now substitute those estimates into the definition of the error:
The left side is the error and the right side is the residual. A residual is the error with statistics written in place of parameters. It is the same construction that turns into and into : you cannot reach the population quantity, so you compute the sample version and use it instead.
The parallel also explains the notation. Greek letters for what you cannot see, Latin letters and hats for what you computed, exactly as in population vs sample.
One place the analogy runs loose, and it is worth knowing. A parameter such as is a single fixed constant, while an error belongs to one observation and differs from point to point. So a residual is estimating something that varies rather than something that sits still. The observability half of the parallel is exact; the fixed-target half is not.
The check you can run: residuals sum to zero, errors do not
Here is a consequence you can verify on your own paper, and it is the cleanest proof that residuals are not errors.
Least-squares residuals add to exactly zero. The least-squares line passes through the mean point , so
The fitting procedure imposes that. It is true for a superb fit and a hopeless one alike, which is why fit gets judged from squared residuals rather than from their total, as why we square the residuals works through.
Errors carry no such constraint. Nothing about the true line forces the errors in your particular sample to cancel. A model may assume the errors average out over the long run, but that is a statement about the population, not about your five or fifty observations. With continuous scatter the probability that a sample's errors total exactly zero is zero, so outside of contrived data it never happens.
So the zero total is an artifact of fitting, not a property residuals inherited from errors. Two practical uses:
- Catch your own arithmetic. Add your residuals. If they do not come to zero, allowing for rounding, either you made a mistake or the line you used is not the least-squares line. The second worked example turns this into a diagnostic.
- Understand the . Fitting spends the data twice, once on the intercept and once on the slope, so the fitted line hugs the sample at least as tightly as the true line does and the sum of squared residuals comes out no larger than the sum of squared errors would. Residuals therefore understate the scatter, which is why the standard deviation of the residuals divides by .
Where this fits in AP Statistics
Residuals are topic 5.4 in Unit 5, Regression Analysis, and least-squares regression is topic 5.5. Unit 5 makes up 10 to 20 percent of the multiple-choice section.
The word the course puts in a topic title is residual. Error is the idea a residual estimates, and it is worth understanding for exactly the reason above: it tells you what a residual is standing in for. What the exam asks you to do is compute residuals as observed minus predicted, read the sign as underprediction or overprediction, and use their pattern on a residual plot to judge whether a linear model is appropriate. The topic 5.4 page covers the assessed version.
Two notes on scope. Inference for the slope of a regression model is not part of the Fall 2026 course, so you will not be asked to build a confidence interval or run a test for . And a question can only ask you for an error if it also gives you the true line, which a set of real measurements never does. When you are handed a data set and a fitted equation, the miss you can compute is the residual, so compute observed minus predicted and say residual.
Made-up data, where you can see both
Build five points from a known true line at , using chosen errors of . Fit the least-squares line to the resulting data, find the residuals, and compare them with the errors you put in.
Build the data. At each , the true line gives , which is . Add the chosen errors to get the observed values .
Total the errors: , so their mean is , not 0. Nothing forces errors to cancel.
Now forget you know the true line, which is the situation with real data. Fit least squares to the five points. Means: and .
Deviations from the means: gives and gives . Their products sum to , and the squared deviations sum to .
Slope and intercept: and , so the fitted line is . The true line was , so the fit missed both the intercept and the slope, which is normal.
Predicted values: . Residuals as observed minus predicted: , , , , .
Total the residuals: , exactly, as least squares guarantees.
Line the two lists up. Errors: . Residuals: . The point at has a positive error of 1 but a negative residual of , so the residual there does not even agree with the error on direction.
Compare the squared totals. Squared errors: . Squared residuals: . The fitted line beats the true line on this sample, because least squares minimizes that total over every line and the true line is just one of them.
The errors are , totalling 5. The residuals from are , totalling 0. The first two match closely and the last three do not: the error of 2 comes back as a residual of 1.0, the error of 3 as a residual of 0.6, and the error of 1 at as a residual of , which disagrees even in sign. The residuals give a smaller squared total (9.10 against 19) because the fitted line was chosen to make that total as small as possible. With real data you would see only the second list.
Using the zero total to catch a mistake
Six students study 1, 2, 3, 4, 5 and 6 hours and score 60, 72, 65, 78, 71 and 86. The least-squares line is . A student computes the residuals as . Without redoing all six, show that at least one is wrong and find it.
Apply the check. Least-squares residuals must total zero, so add them: . That is not zero, so at least one residual is wrong.
Read the size of the gap. Reversing one subtraction flips that residual's sign, which shifts the total by twice its value. So if exactly one entry has its subtraction reversed, a total of 10 points at a residual of size recorded as positive. Check that candidate first, and if fixing it does not clear the total, recompute the rest: two compensating slips would give the same 10 with no size-5 culprit.
Check the candidate. The residual of sits at . Predicted: . Observed: .
Do the subtraction in the required order, observed minus predicted: , not . The student computed predicted minus observed there.
Correct it and recheck: . The total is now zero, as it must be.
Read the corrected sign in context. The residual at is negative, so that student scored below the line and the model overpredicted their score by 5 points.
The residuals total 10 rather than 0, so the list is wrong. The residual at should be , not ; the student reversed the subtraction there. With the correction the six residuals are and they total zero. Note that this check works only because these are residuals from a least-squares fit. Errors would give no such signal.
Frequently asked questions
Is a residual just another name for an error?
No. A residual is observed minus predicted, measured from the line you fitted to your sample. An error is observed minus the value on the true line, which is a population quantity nobody knows. Residuals are computable, errors are not, and the two lists agree all the way down only if your fitted line happened to land exactly on the true one.
Can you ever compute an actual error?
Only when you built the data yourself. In a simulation you choose the true line and the scatter, so you know every error. With real measurements the true line is unknown, so there is no way to get at them, and the residual is what you use instead.
Do errors add up to zero the way residuals do?
No. A least-squares fit forces its residuals to total exactly zero, because the line passes through . Errors have no such constraint. A model may assume they average out in the long run, but with continuous scatter the handful of errors in one sample never totals exactly zero.
Why do least-squares residuals always sum to zero?
Because the sum equals , and the least-squares line runs through the mean point , which makes the bracket zero. It is a property of the fitting method, so it holds for a good fit and a bad one alike and tells you nothing about quality.
Is a residual the same as a deviation?
No, and the difference is again which thing you subtract. A deviation is , the distance from a value to the mean of the response. A residual is , the distance from a value to the fitted line at that point's . Compare them directly in deviation vs residual.