Residual Calculator

Calculate the residual (prediction error) as the difference between the observed and predicted values in regression.

Residual

4.000000

Predicted Value (y-hat)41.0000
|Residual|4.000000
Squared Residual16.0000

Residual vs Observed Value (y)

公式

## How to Calculate a Residual ### Formula **Residual = Observed - Predicted = y - y_hat** where y_hat = b0 + b1*x A residual is the vertical distance between an observed data point and the regression line. Positive residuals mean the point is above the line; negative means below. In least-squares regression, the sum of all residuals is zero. Examining residuals helps detect model violations.

计算示例

Regression: y = 5 + 2x. At x = 18, the observed y = 45.

  1. 01Predicted y_hat = 5 + 2*18 = 5 + 36 = 41
  2. 02Residual = 45 - 41 = 4
  3. 03The observed value is 4 units above the regression line
  4. 04Squared residual = 4^2 = 16

常见问题

What should a residual plot look like?

Ideally, residuals should be randomly scattered around zero with no pattern. Patterns (curves, funnels, clusters) suggest the model is misspecified or assumptions are violated.

Why do residuals sum to zero?

In least-squares regression with an intercept, the math guarantees the sum of residuals equals zero. This means the line passes through the centroid (x_mean, y_mean) and overpredictions balance underpredictions.

What is a standardized residual?

A standardized residual divides the raw residual by its estimated standard deviation. Values beyond +/-2 are considered unusual; beyond +/-3 are potential outliers.

学习

Understanding the Normal Distribution

相关计算器