A residual is what a model gets wrong for one data point: the observed value minus the value the model predicted, e = y − ŷ. A positive residual means the point lies above the fitted line or curve, a negative one that it lies below. For a least-squares model with an intercept the residuals always add up to zero, so their size is measured by the sum of squared residuals (SSE), the root-mean-square error and the residual standard error.
Residuals are the main diagnostic tool of regression. Plotted against x they should look like a random cloud around zero. A curved band means the model is missing curvature (try a higher degree), a funnel that widens means the scatter grows with x, and a single far-off point flags a possible outlier or typing error. Standardised residuals – each residual divided by the residual standard error – make this easier to judge: values beyond about ±2 deserve a second look, and beyond ±3 are rare if the model is right.
Enter your data, pick the model and the calculator shows the full residual table, both charts and a short verdict. Fill in a point (x, y) at the bottom to get the prediction and residual for a single observation.
How to use the Residual Calculator
- Model
- x values
- y values — Same number of values as x
- Single point: x — Optional – leave empty to skip
- Single point: observed y
- Precision (significant figures)
Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.
How it works
The tool fits the chosen polynomial by least squares (normal equations), computes ŷ and e = y − ŷ for every point, then SSE, RMSE, mean absolute residual and the residual standard error with n − p degrees of freedom. The single-point residual is y₀ − ŷ(x₀).
Worked example
Data x = 1…7 and y = 3.1, 4.9, 7.2, 8.8, 11.3, 12.6, 15.4. The least-squares line is ŷ = 2.014x + 0.9857. The residuals are 0.100, −0.114, 0.171, −0.243, 0.243, −0.471 and 0.314; they sum to 0 and their squares to SSE = 0.4914. The residual standard error is √(0.4914 ÷ 5) = 0.3135, so the largest residual (point 6, −0.471) is −1.50 standard errors – not unusual. For the single point x = 4, y = 8.8 the prediction is 9.043 and the residual −0.243.
Reading a residual plot
- Random band around zero – the model fits well.
- U-shape or arch – curvature is missing; try a quadratic or cubic.
- Funnel – the spread changes with x; consider a log transformation.
- One isolated point – check it for errors before deciding what to do.
Formula
Residual e = y − ŷ · SSE = Σe² · RMSE = √(SSE ÷ n) · standard error s = √(SSE ÷ (n − p)) · standardised residual = e ÷ s
Worked example
Inputs — Model: Linear y = a₁x + a₀; x values: 1, 2, 3, 4, 5, 6, 7; y values: 3.1, 4.9, 7.2, 8.8, 11.3, 12.6, 15.4; Single point: x: 4; Single point: observed y: 8.8; Precision (significant figures): 4.
Results — Sum of squared residuals (SSE) = 0.49143; Residual table = # x y ŷ (fitted) Residual y − ŷ Standardised
─────────────────────────────────────────────────────────
1 1 3.1 3 0.1 0.319
2 2 4.9 5.014286 −0.114286 −0.365
3 3 7.2 7.028571 0.171429 0.547
4 4 8.8 9.042857 −0.242857 −0.775
5 5 11.3 11.057143 0.242857 0.775
6 6 12.6 13.071429 −0.471429 −1.504
7 7 15.4 15.085714 0.314286 1.002; Fitted equation = y = 2.014x + 0.9857; Check for unusual points = No standardised residual is beyond ±2.; Largest residual = Point 6 (x = 6, y = 12.6): residual −0.4714, −1.5 standard errors; Sum of residuals = 0.
Key terms
- Residual
- Observed minus predicted value, e = y − ŷ.
- Standardised residual
- Residual divided by the residual standard error.
- SSE
- Sum of squared residuals.
- RMSE
- Root-mean-square error, √(SSE ÷ n).
- Outlier
- A point with an unusually large residual.
Frequently asked questions
How do you calculate a residual?
Residual = observed y − predicted ŷ. If the line predicts 9.04 at x = 4 and you observed 8.8, the residual is 8.8 − 9.04 = −0.24.
What does a negative residual mean?
The observed point lies below the fitted line – the model over-predicted it.
Why do the residuals add up to zero?
For a least-squares fit that includes an intercept, the positive and negative residuals cancel exactly (up to rounding).
What is a residual plot?
A scatter plot of residuals against x (or ŷ). A good model gives a random, patternless band around zero.
What is the difference between RMSE and the residual standard error?
RMSE divides SSE by n; the residual standard error divides by n − p (the degrees of freedom), which corrects for the fitted coefficients.
When is a residual too large?
A standardised residual (e ÷ s) beyond ±2 is unusual and beyond ±3 very unusual if the errors are roughly normal.
What is the sum of squared residuals used for?
It is the quantity least squares minimises, and it feeds R², the standard error and F-tests.