What is a residual in regression?
A residual in regression is the difference between an observed target value and the value predicted by the regression model.
It tells us how far a prediction is from the actual value for a particular observation.
Residual formula
Residual = Actual value - Predicted valueor:
e = y - ŷwhere:
yis the actual target valueŷis the predicted target valueeis the residual
Simple example
Suppose the actual house price is:
₹60 lakhbut the model predicts:
₹55 lakhThen:
Residual = 60 - 55 = +5 lakhThe positive residual means the model underpredicted the actual value by ₹5 lakh.
What does a negative residual mean?
If:
Actual value = 50
Predicted value = 58then:
Residual = 50 - 58 = -8A negative residual means the model overpredicted the target.
What does a residual of zero mean?
A residual of zero means:
Actual value = Predicted valueSo the model predicted that observation exactly.
Residuals are available after fitting the model
Once a regression model makes predictions on known observations, a residual can be calculated for each one.
These residuals help us understand where and how the model is making errors.
Residual vs error term
The theoretical regression model contains an unknown error term, representing the true unexplained part of the target.
A residual is the observed estimate of that error after the model has been fitted.
Error term → theoretical and unobserved
Residual → calculated from actual and predicted valuesWhy residuals matter
Residuals are useful for checking whether the regression model is behaving as expected.
Patterns in residuals can reveal problems such as nonlinearity, changing error variance, unusual observations, or other model misspecification.
How residuals are analyzed is covered in the next article.
In short, a residual is the difference between an actual target value and the model's prediction for that observation.
Learning Sequence
Machine Learning Curriculum
Explore Related Questions
Deepen your understanding across related Machine Learning topics.