Residual Calculator Formula
Understand the math behind the residual calculator. Each variable explained with a worked example.
Formulas Used
Residual (e)
residual = actual - predictedAbsolute Residual
abs_residual = abs(actual - predicted)Squared Residual
squared_residual = pow(actual - predicted, 2)Variables
| Variable | Description | Default |
|---|---|---|
actual | Actual Value (y) | 25 |
predicted | Predicted Value (y-hat) | 23.5 |
How It Works
Regression Residuals
A residual is the difference between an observed value and its predicted value from the regression model. Residuals are the foundation for assessing model fit and detecting problems.
Formula
e_i = y_i - y-hat_i
Positive residuals mean the model under-predicted; negative residuals mean over-prediction. In a well-fitting model, residuals should be randomly scattered around zero with no patterns.
Worked Example
An observation with actual y = 25 and predicted y-hat = 23.5.
actual = 25predicted = 23.5
- 01Residual = 25 - 23.5 = 1.5
- 02The model under-predicted by 1.5 units.
- 03Squared residual = 1.5² = 2.25
Ready to run the numbers?
Open Residual Calculator