Optional extension: Frequency density, interpolation and fitted lines
Example 1
Fit y=mx+c by least squares using m=Σ[(x−xˉ)2]Σ[(x−xˉ)(y−yˉ)] and c=yˉ−mxˉ. What does the fitted line predict at x=4?
Show worked answer
Answer: 19
- xˉ=2 and yˉ=11.
- The covariance numerator is 8, and the denominator is 2
- m=4,c=3.
- At x=4,y=19.
Example 2
A model predicts y=4x+4. For the observations in the table, find the sum of squared residuals Σ(observed − predicted)2.
Show worked answer
Answer: 96
- The residuals are 4,−4,8.
- Their squares sum to 96.
Example 3
Fit y=mx+c by least squares using m=Σ[(x−xˉ)2]Σ[(x−xˉ)(y−yˉ)] and c=yˉ−mxˉ. What does the fitted line predict at x=4?
Show worked answer
Answer: 18
- xˉ=2 and yˉ=12.
- The covariance numerator is 6, and the denominator is 2
- m=3,c=6.
- At x=4,y=18.