What are the residuals?
Paste paired x and y values. The calculator fits the least-squares line and shows each point's residual, the observed y minus the predicted ŷ, with the sum of squared residuals.
- Residuals (y − ŷ)
- −0.8, 0.6, 1, −0.6, −0.2
The residuals from ŷ = 0.6x + 2.2 are −0.8, 0.6, 1, −0.6, −0.2.
- Regression line
- ŷ = 0.6x + 2.2
- Slope (b)
- 0.6
- Intercept (a)
- 2.2
- Sum of squared residuals (SSE)
- 2.4
- Residual standard deviation (s)
- 0.894427
- Number of points (n)
- 5
Residuals (y − ŷ): −0.8, 0.6, 1, −0.6, −0.2. The residuals from ŷ = 0.6x + 2.2 are −0.8, 0.6, 1, −0.6, −0.2.
Residuals by x
Every point
How to calculate
Finds the residual y − ŷ of every point from the least-squares regression line, with the predicted values, the sum of squared residuals (SSE), and the residual standard deviation.
Example with the default inputs (x values [1, 2, 3, 4, 5], y values [2, 4, 5, 4, 5]): The residuals from ŷ = 0.6x + 2.2 are −0.8, 0.6, 1, −0.6, −0.2.
Method: b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²; a = ȳ − b x̄; ŷ = a + bx; residual = y − ŷ; SSE = Σ(y − ŷ)²; s = √(SSE ÷ (n − 2)).
- The line is the least-squares regression line of y on x, fitted to all the points you enter.
- A positive residual means the point is above the line; a negative one, below it.
- The residuals of a least-squares line with an intercept always add up to 0.
Worked examples
Each example is checked against the calculator on every build.
- x values 1, 2, 3, 4, 5, y values 2, 4, 5, 4, 5 gives Residuals (y − ŷ) −0.8, 0.6, 1, −0.6, −0.2, Regression line ŷ = 0.6x + 2.2, Slope (b) 0.6, Intercept (a) 2.2, Sum of squared residuals (SSE) 2.4, Residual standard deviation (s) 0.894427, Number of points (n) 5.Source: OpenStax, Introductory Statistics 2e, §12.3 The Regression Equation (the residual is y − ŷ, positive above the line; SSE is the sum of the squared residuals, which the least-squares line minimises), https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation (retrieved 2026-10-05)
- x values 0, 1, 2, 3, y values 10, 7, 4, 1 gives Residuals (y − ŷ) 0, 0, 0, 0, Regression line ŷ = −3x + 10, Sum of squared residuals (SSE) 0, Residual standard deviation (s) 0.Source: OpenStax, Introductory Statistics 2e, §12.3 The Regression Equation (the residual is y − ŷ, positive above the line; SSE is the sum of the squared residuals, which the least-squares line minimises), https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation (retrieved 2026-10-05)
- x values 0.1, 0.2, 0.3, y values 0.3, 0.1, 0.2 gives Residuals (y − ŷ) 0.05, −0.1, 0.05, Regression line ŷ = −0.5x + 0.3, Sum of squared residuals (SSE) 0.015.Source: OpenStax, Introductory Statistics 2e, §12.3 The Regression Equation (the residual is y − ŷ, positive above the line; SSE is the sum of the squared residuals, which the least-squares line minimises), https://openstax.org/books/introductory-statistics-2e/pages/12-3-the-regression-equation (retrieved 2026-10-05)
How it works
For n pairs (x, y):
- The least-squares line is ŷ = a + bx, with b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)² and a = ȳ − b x̄.
- Each point's predicted value is ŷ = a + bx, and its residual is e = y − ŷ.
- SSE = Σe², and the residual standard deviation s = √(SSE ÷ (n − 2)), shown for 3 or more points.
The headline lists the residuals in the order you entered the points, each rounded half up from its exact value to 10 significant digits, with a true minus sign. The table and the plot list the points from the smallest x to the largest (equal x values in entry order); the Point column gives each one's place in your lists.
Rules:
- 2 to 1,000 pairs. The first x goes with the first y. Lists of different lengths, or x values that are all the same, give no answer, with a message.
- The line, every ŷ, every residual and SSE are exact on the decimals you type, rounded once for display; only s uses a floating-point square root. A value too large or too small to show gives no answer, with a message.
- The line in the result shows each coefficient to 6 significant digits.
Assumptions
- The line is the regression of y on x, fitted to all the points you enter. To find the residual of a point from another line, use that line's ŷ.
Worked examples by hand
x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 5 (the default). x̄ = 3, ȳ = 4, Σ(x − x̄)² = 10 and Σ(x − x̄)(y − ȳ) = 6, so b = 0.6 and a = 4 − 1.8 = 2.2. The predicted values are 2.8, 3.4, 4, 4.6, 5.2, and the residuals are −0.8, 0.6, 1, −0.6, −0.2. SSE = 0.64 + 0.36 + 1 + 0.36 + 0.04 = 2.4, and s = √(2.4 ÷ 3) = 0.894427.
x = 0, 1, 2, 3 and y = 10, 7, 4, 1. Every point is on ŷ = −3x + 10, so every residual is 0 and SSE = 0.
x = 0.1, 0.2, 0.3 and y = 0.3, 0.1, 0.2. x̄ = ȳ = 0.2, Σ(x − x̄)² = 0.02 and Σ(x − x̄)(y − ȳ) = −0.01, so b = −0.5 and a = 0.2 + 0.1 = 0.3. ŷ = 0.25, 0.2, 0.15, so the residuals are 0.05, −0.1, 0.05 and SSE = 0.015.
Other questions people ask
What is a residual?
A residual is the observed value minus the predicted value: e = y − ŷ. It is the vertical distance from a point to the regression line. A point above the line has a positive residual, and a point below it a negative one.
How do I calculate a residual?
Find the regression line ŷ = a + bx, put the point's x into it to get ŷ, and subtract ŷ from the observed y. For the default data the line is ŷ = 0.6x + 2.2; at x = 3 it gives 4, and the observed y is 5, so the residual is 1.
What is the sum of squared residuals?
SSE is each residual squared, then added up. The least-squares line is the line that makes SSE as small as possible. For the default data SSE = 2.4.
Why do the residuals add up to zero?
For a least-squares line with an intercept, the positive and negative residuals always balance, so their sum is 0. The line passes through the point of means (x̄, ȳ).
What does a residual plot show?
It plots each residual against x. If a straight line suits the data, the residuals scatter around 0 with no pattern. A curve or a funnel shape in the residuals suggests a different model, such as quadratic regression, or a spread that changes with x.
What is the residual standard deviation?
It is s = √(SSE ÷ (n − 2)), the typical size of a residual. It needs at least 3 points, because 2 points always lie exactly on their line.