Residual Calculator
This residual calculator fits a regression line through your x and y values and lists every residual. Example: x = 1 to 6 and y = 2.1 to 11.6 give ŷ = 1.95143 · x + 0.153333, and the largest residual is 0.389524.
Source: Wikipedia – Errors and residuals. Updated: .
How it is calculated
A residual is what the regression line leaves over: the difference between the measured y and the predicted ŷ. Residuals show how well a straight line fits the data.
Formulas and working
First the means x̄ and ȳ are found. The slope is b₁ = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)² and the intercept b₀ = ȳ − b₁ · x̄. For every point, ŷ = b₀ + b₁ · x and the residual is e = y − ŷ. The sum of squares SSE = Σe² is divided by n − 2, and its square root is the residual standard error s. With least squares, Σe = 0 always holds.
Worked example
For x = 1, 2, 3, 4, 5, 6 and y = 2.1, 3.9, 6.2, 7.8, 10.3, 11.6, x̄ = 3.5 and ȳ = 6.98333. Σ(x − x̄)² = 17.5 and Σ(x − x̄)(y − ȳ) = 34.15, so b₁ = 34.15 / 17.5 = 1.95143 and b₀ = 0.153333. At x = 5, ŷ = 9.91048 and the residual is 10.3 − 9.91048 = 0.389524, the largest in the list. SSE is 0.307048, the residual standard error 0.277059 and R² = 0.995414.
- A positive residual means the observation lies above the line, a negative one below.
- A few very large residuals point to outliers.
- The calculator uses only a straight line; for curved patterns see quadratic regression.
Frequently asked questions
How do you calculate a residual?
Residual = measured y − predicted ŷ on the regression line. For x = 5 it is 10.3 − 9.91048 = 0.389524.
Why do residuals sum to zero?
The least-squares line passes through the centroid (x̄ | ȳ), so the deviations above and below cancel exactly.
What does a residual pattern tell me?
If residuals scatter randomly around zero, the line fits. A curve points to a curved relationship, a funnel to growing spread.
Sources and legal basis
As of: · Editorial policy
Related tools
- Linear Regression CalculatorLinear regression calculator: regression line, slope, R², standard errors and prediction from your data pairs, with scatter plot and residuals. Free.
- Correlation Coefficient CalculatorCorrelation coefficient calculator for paired data: Pearson r and Spearman ρ with p-value, confidence interval, R² and regression line. Paste a table.
- Covariance CalculatorCovariance calculator for two data series: sample (n − 1) or population (n), with both means, sum of products, steps and the correlation coefficient.
- Quadratic Regression CalculatorQuadratic regression calculator: the parabola y = ax² + bx + c through your data points, with R², vertex, prediction and residuals and the working shown.
- Standard Error CalculatorStandard error calculator for raw data or for standard deviation and sample size: SE = s / √n with steps, mean and variance shown for every result.
- Standard deviation calculatorStandard deviation calculator for a list or frequency table: switch between sample (s) and population (σ), see every step in a table, plus a box plot.
- Online CalculatorCalculator online, free and instant: type or tap and see the answer as you go – order of operations, brackets, percent, square root, steps and a history list.
- CGPA to Percentage Calculator (and Percentage to CGPA)CGPA to percentage calculator for the 10-point scale: CBSE formula (CGPA × 9.5), × 10 or your university’s own formula – also percentage to CGPA, with working.
- GPA calculator for Australian universities (7-point scale)GPA calculator Australia: enter each course with its grade (HD, D, C, P or 1–7) and credit points to get your GPA on the 7-point or 4-point scale, with working.