Deviation vs Residual

Both terms below come up in the same part of the course, and students mix them up. Here is each one defined on its own, side by side, so you can see where they part company.

Deviation

Describing data

A deviation is the signed distance from a single data value to the mean, found by subtracting the mean from that value.

A deviation belongs to a single observation, not to a data set. It is written xixˉx_i - \bar{x}, where xix_i is one value and xˉ\bar{x} (x-bar) is the mean of all of them, and it keeps the units of the data. The sign is part of the answer: positive puts the value above the mean, negative below it.

For 4, 7, 9, 12, 13 the mean is 45/5=945/5 = 9, so the five deviations are -5, -2, 0, 3, and 4. They add to exactly 0, which is not a fact about this data set: (xixˉ)=xinxˉ\sum (x_i - \bar{x}) = \sum x_i - n\bar{x}, and nxˉn\bar{x} is the total by definition, so the terms cancel every time. Squaring first rescues the idea. Those squared deviations are 25, 4, 0, 9, and 16, summing to a sum of squares of 54, which divided by n1=4n - 1 = 4 gives a variance of 13.5 and a standard deviation of 3.67.

"The deviation of this data set is 3.67" is a category error and the most common one on this page. Five values have five deviations; 3.67 is the standard deviation, one summary built from all of them. Calling one number the deviation of a whole set throws away the distinction that makes the formula work.

The exact-zero check only holds on an unrounded mean. On a set whose mean comes out as 9.333, rounding it to 9.3 before subtracting leaves the deviations missing zero by a little, a rounding artifact and not an error in the data. A deviation is also not a residual: a deviation measures a value against the mean of its own variable, while a residual, yy^y - \hat{y} (y minus y-hat), measures an observed response against what a model predicted.

Absolute values are the other way to stop the cancellation. Averaging xixˉ|x_i - \bar{x}| gives the mean absolute deviation, (5+2+0+3+4)/5=2.8(5 + 2 + 0 + 3 + 4)/5 = 2.8 here. Squaring wins out because squared deviations have algebra behind them that absolute values do not, which is why ss carries through the rest of the course.

Full entry for deviation

Residual

Regression and correlation

A residual is the difference between an observed y-value and the value the regression line predicts for it: observed minus predicted.

A residual belongs to one data point and one fitted line, and the order of the subtraction is fixed: residual=yy^\text{residual} = y - \hat{y}, observed minus predicted, where y^\hat{y} (read y-hat) is the height of the line above that point's xx. The sign is where the meaning lives. A positive residual puts the observation above the line, so the model underpredicted it, and a negative residual puts it below, so the model overpredicted.

Six students study 1, 2, 3, 4, 5 and 6 hours and score 60, 72, 65, 78, 71 and 86. The least-squares line for them is y^=58+4x\hat{y} = 58 + 4x. For the student who studied 5 hours the line gives y^=58+4(5)=78\hat{y} = 58 + 4(5) = 78, and that student scored 71, so the residual is 7178=771 - 78 = -7. The line overpredicted that score by 7 points. Doing the same at every xx gives residuals of -2, 6, -5, 4, -7 and 4.

The error that costs points is the reversed subtraction. "The residual is 7, so the line missed by 7" keeps the size and throws the direction away, and computing predicted minus observed flips the sign of every residual in the table, turning each overprediction into an underprediction. Say observed minus predicted every time, and read a negative residual as the line sitting above the data point.

Two things bound what a single residual can tell you. It is measured against one particular line, so change the line and every residual changes with it. And for a least-squares line fitted with an intercept the residuals add to exactly zero: here 2+65+47+4=0-2 + 6 - 5 + 4 - 7 + 4 = 0. Their mean is zero for a good fit and for a hopeless one alike, which is why fit gets judged from the squared residuals and from the shape of the residual plot, never from their average.

Residuals are topic 5.4 in Unit 5, Regression Analysis, of the Fall 2026 AP Statistics course.

Full entry for residual

Where each one fits in the course