Residual Calculator
A regression line makes a promise at every data point, and the residual is the broken-or-kept measure of that promise: residual = actual Y − predicted ŷ. This calculator fits the least-squares line to your paired data and lists every residual in order, then totals the diagnostics that matter — the sum of residuals (which theory says must be zero), the residual sum of squares that feeds R² and RMSE, and the largest miss in the set, flagged with the point that produced it. If a model has a secret — a curve it cannot bend to, one wild observation — the residuals are where it confesses.
What a Residual Is, and the Zero-Sum Law
For each observation the fitted line predicts ŷ = a + bx; the residual e = y − ŷ is the signed miss — positive when the point sits above the line (the model under-predicted), negative when below. Two laws govern the collection. First, for any least-squares line fitted with an intercept, the residuals sum to exactly zero: the line is balanced on the data the way a beam balances on its fulcrum, a fact this calculator prints so you can watch it hold (to rounding) on your own numbers — and a diagnostic in itself, because software that reports a non-zero sum has fitted a no-intercept model or made an error. Second, the residuals’ squares sum to the SS residual, the unexplained variation of the data set — the denominator-side quantity in R², the numerator of the error variance, and the raw material of RMSE, the typical size of a miss in Y’s own units. A regression report without its residuals is a verdict without evidence; this page exists to produce the evidence.
Worked Example: The Five-Point Confession
Take the paired data from the R² page: X = 1…5, Y = 2, 4, 5, 4, 5, with fitted line ŷ = 2.2 + 0.6x predicting 2.8, 3.4, 4.0, 4.6, 5.2. Residual by residual: 2 − 2.8 = −0.8; 4 − 3.4 = +0.6; 5 − 4.0 = +1.0; 4 − 4.6 = −0.6; 5 − 5.2 = −0.2. The sum is exactly 0, as the law requires. Their squares — 0.64, 0.36, 1.00, 0.36, 0.04 — total SS residual = 2.40, and RMSE = √(2.40/5) = 0.69: the line’s typical miss is about 0.7 Y-units. The largest residual, +1.0 at x = 3, is the point the line understands least. Nothing in the pattern (− + + − −, alternating without a wave) suggests structure left behind — for five points, this is what honest noise looks like, and the next section shows the patterns that should worry you instead.
Reading the Pattern: What Residual Plots Accuse
Individual residuals are anecdotes; plotted against X (or against ŷ), they become testimony, and four patterns recur in every statistician’s casebook. A curve in the plot — residuals negative at the ends, positive in the middle, or the reverse — says the straight line is the wrong shape: the relationship bends and the model cannot. A funnel — spread widening with X — says the noise itself grows (heteroscedasticity): predictions for large X deserve wider intervals than for small, and the honest fix is a transformation or a weighted fit. A solitary giant — one residual dwarfing the rest — flags an outlier: possibly a recording error, possibly the most interesting observation in the study, always a point to investigate rather than silently delete (report results with and without it). A run or drift in time-ordered data says the errors are not independent — yesterday’s miss predicts today’s — and time-series machinery, not ordinary regression, owns the problem. The calculator’s list, read in X order, is the plot in numerical form; run your eye down it for waves and funnels before you quote any coefficient the line produced.
Standardized Residuals and Leverage, in Brief
Raw residuals share a flaw: they are expected to be larger where X is extreme, because the line is pinned less firmly at its ends — a point can have leverage over the fit. Dividing each residual by its standard error gives the standardized residual, putting all misses on one scale where |value| above about 2 invites a look and above 3 demands one. The related studentized version refits without the point in question, answering “how surprising is this point to a model that never met it?” High-leverage points — X far from x̄ — deserve their own suspicion even when their residuals are small, because a small residual at a leverage point may mean the line bent to swallow it (Cook’s distance formalises the influence). None of this requires leaving this page’s output: find the big residuals here, note their X positions against the mean of X, and you have performed the field’s standard first interrogation with a list of numbers and a pencil.
A Diagnosis Performed: R² 0.96 and Still the Wrong Model
Feed this calculator a curve in disguise: X = 1, 2, 3, 4, 5 against Y = 1, 4, 9, 16, 25 — a perfect parabola, Y = X². The least-squares line (ŷ = −7 + 6x) fits impressively by the usual headline: SS residual = 14 against SS total = 374, an R² of 0.9626 that would satisfy most reports. Now read the residuals the calculator lists: +2, −1, −2, −1, +2 — positive at both ends, negative through the middle, a symmetric frown with not a whisper of randomness in it. That pattern is the signature of curvature the line cannot express, and it convicts the model in one glance at evidence the R² concealed: the line overshoots the middle and undershoots the ends on a perfect, noiseless relationship. Include the X² term (or model the curve properly) and the residuals collapse to zeros. Pin the moral where you work: R² grades how much variation the line absorbed; the residuals grade whether the line deserved to — and only the second grade is about correctness.
Residuals in Time: The Durbin–Watson Glimpse
When the data arrive in time order — monthly sales, daily temperatures — one more pattern matters beyond shape: whether each residual predicts the next. The Durbin–Watson statistic compresses the check into one number, DW ≈ 2(1 − r₁), where r₁ is the correlation between consecutive residuals. DW near 2 means independence, the regression assumption intact; DW sinking toward 0 betrays strong positive autocorrelation (misses arrive in runs — the model’s standard errors are then optimistically small, sometimes wildly); DW toward 4 signals alternating over- and under-prediction. You can eyeball the same diagnosis from this calculator’s ordered list — long runs of one sign are autocorrelation visible to the naked eye — but the statistic’s value is that it survives the eyeball’s optimism. Time-stamped data with runny residuals belongs to time-series methods, and discovering that from a residual list is a better outcome than any coefficient the wrong model could print.
Related Tools
More from the Statistics Calculators hub: the Coefficient of Determination Calculator turns this page’s SS residual into R², the live Correlation Calculator measures the linear association directly, and the Descriptive Statistics Calculator portraits the raw data before any line is fitted.
Frequently Asked Questions
Should residuals sum to zero?
Yes — exactly, for least-squares regression with an intercept term. It is an algebraic property of the fit, not a coincidence. A non-zero sum in a report means the model was forced through the origin (no intercept), was fitted by another criterion, or contains an arithmetic error.
What is the difference between a residual and an error?
The error is the unknowable gap between an observation and the true underlying relationship; the residual is its estimable stand-in, the gap between the observation and your fitted model. Residuals are what you can compute — this page computes them — and inference proceeds by treating them as the errors’ sample.
How large a residual is too large?
Context decides: compare with RMSE (the typical miss) and with the standardized scale — |standardized residual| above 2 is worth a look, above 3 a hard look. A residual ten times the RMSE in otherwise tidy data usually means a data problem; in genuinely noisy fields it may mean an honest extreme.
What is RMSE, exactly?
Root mean square error: the square root of the mean squared residual, in Y’s units — the model’s typical miss size. Some texts divide the squared sum by n − 2 instead of n (the standard error of the estimate), which for the worked example gives 0.894 rather than 0.693; both conventions live in the literature and the calculator states which it prints.
My residuals form a U shape. Now what?
The relationship curves and a straight line is the wrong tool: consider a quadratic term, a transformation of X or Y, or a genuinely nonlinear model. A U (or inverted U) is the residuals telling you, in the clearest dialect they have, that structure remains unmodelled — quoting the line’s coefficients anyway is the error this page exists to prevent.
Can I get residuals for multiple regression here?
This page fits the single-predictor line, the case textbooks build intuition on and the case where residuals can be listed and eyeballed completely. Multiple regression residuals obey the same definitions — actual minus predicted, summing to zero with an intercept — and are produced by the regression software that fitted the model; the reading skills transfer unchanged.