Worked examples · Sheet 3
Residuals and the normal equations
Theory used:Fitted values and residualsThe least-squares line with an intercept
Go to: Exercise 1Exercise 2
Exercise 1
For the data , , and the fitted line is . Calculate the residuals and identify the point above the line.
Substitute each predictor value into the line to obtain the fitted values , , and . Then subtract each fitted value from the response observed at the same predictor value to obtain the residual, .
At the second point the observed response exceeds the fitted value , so its residual is positive and the point lies above the line. The first and third observed responses are below their fitted values, giving negative residuals and points below the line.
The residuals sum to zero, as do their products with the predictor values. These are the two normal equations for regression with an intercept. Both hold, confirming the given line as the least-squares fit for the data.
Exercise 2
A least-squares line with an intercept is fitted at predictor values . The first two residuals are and . Find the other two.
The residuals from a least-squares line with an intercept satisfy the two normal equations and . Substituting the known residuals gives a linear system in and .
The first normal equation requires the residuals to sum to zero. The two known residuals cancel, so the remaining two must also cancel, giving .
The second normal equation requires the predictor-weighted sum of residuals to be zero. The first contribution is zero because its predictor is , and the second contribution is . The remaining contributions must therefore sum to .
Substituting into the second equation gives and hence . The determinant is , so the solution is unique. The missing residuals are and .