残差计算器
计算回归模型中观测值与预测值之间的残差。
Residual
4.000000
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.
- 01Predicted y_hat = 5 + 2*18 = 5 + 36 = 41
- 02Residual = 45 - 41 = 4
- 03The observed value is 4 units above the regression line
- 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.
学习