Residuals and least squares
For a data point, the residual is the actual response value minus the value predicted by the fitted line at the same explanatory value. Least squares chooses the line that minimises the sum of squared residuals
- Predict at the same explanatory value Substitute the point's explanatory value into the fitted line to find its predicted response \(\displaystyle \hat{y}=a+b\left(x_i\right)\)
- Subtract predicted from actual Calculate the residual as the actual response value minus the predicted response value \(\displaystyle e_i=y_i-\hat{y}_i\)
- Keep the sign A positive residual is above the fitted line and a negative residual is below it \(\displaystyle e_i>0\Rightarrow\text{above the line},\quad e_i<0\Rightarrow\text{below the line}\)
- Square before adding Least squares minimises the sum of squared residuals so positive and negative residuals cannot cancel \(\displaystyle \text{least squares: minimise }\sum e_i^{2}\)
Worked example
A fitted line predicts processing time in minutes from the number of parcels handled. The line and one case are shown below. Calculate its residual and state what least squares minimises
- \(\displaystyle \hat{y}=8+0.4\times15=8+6=14\)Substitute the explanatory value 15 into the fitted line to find the predicted time
- \(\displaystyle e=y-\hat{y}=12-14=-2\)Subtract predicted time from actual time, giving a negative residual because the point is below the line
- \(\displaystyle e^{2}=\left(-2\right)^{2}=4\)Squaring this residual makes its contribution to the least-squares total positive
- \(\displaystyle \text{least squares minimises }\sum e_i^{2}\)The fitted line is chosen to make the total of all squared vertical residuals as small as possible
Common mistakes
Difficulty levels
Questions about this topic
What is a residual?+
A residual is the actual response value minus the value predicted by the fitted line at the same explanatory value
Why can a residual be negative?+
If the actual response is below the fitted line, the actual value is less than the predicted value, so actual minus predicted is negative
Why does least squares square residuals?+
Squaring makes every contribution non-negative and prevents positive and negative residuals from cancelling. The fitted line can then be chosen by the smallest total
Can I use a calculator?+
A calculator is allowed unless a question is marked no calculator
Which year level and chapter is this?+
Year 11, VCE Units 1 & 2, General Mathematics, chapter 7: Bivariate data