Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Residual (y − ŷ)
2
observed minus predicted
Absolute residual 2
Squared residual 4
Percent error 20%

What is a residual?

A residual is the difference between an actual observed value and the value predicted by a model or regression line. It measures how far off a prediction is for a single data point. A positive residual means the model under-predicted (the true value was higher); a negative residual means it over-predicted. Residuals are the building blocks of model-fitting techniques such as ordinary least squares, where the goal is to minimize the sum of squared residuals.

Scatter plot with a regression line showing the vertical gap between a data point and the line
A residual is the vertical distance between an observed point and the regression line.

How to use this calculator

Enter the observed value (y), which is the real, measured data point, and the predicted value (ŷ), which comes from your regression line or model. The calculator returns the residual along with its absolute value, its square, and the percent error relative to the observed value.

The formula explained

The residual is defined simply as:

$$e = \text{Observed }(y) - \text{Predicted }(\hat{y})$$

Here y is the observed value and ŷ ("y-hat") is the predicted value. The squared residual is \(e^2\), and the percent error is \((e / y) \times 100\), which expresses the error relative to the observed quantity.

Advertisement
Diagram showing residual equals observed value minus predicted value
Residual = observed (y) minus predicted (ŷ).

Worked example

Suppose a regression model predicts a house price of \(\hat{y} = 320{,}000\) but the home actually sold for \(y = 350{,}000\). The residual is $$350{,}000 - 320{,}000 = 30{,}000.$$ The absolute residual is \(30{,}000\), the squared residual is \(900{,}000{,}000\), and the percent error is \((30{,}000 / 350{,}000) \times 100 \approx 8.57\%\). Because the residual is positive, the model under-predicted the price.

FAQ

What does a residual of zero mean? The prediction was exactly correct — the observed and predicted values are identical.

Why do we square residuals? Squaring removes the sign and penalizes large errors more heavily, which is why least-squares regression minimizes the sum of squared residuals.

Is a residual the same as an error? They are closely related. "Error" usually refers to the deviation from the true (unknown) population value, while "residual" is the deviation from the fitted model's prediction.

Last updated: