Fitting temperature data¶
Here are the 5-year temperature averages again.
The standard best-fit line results from using a linear polynomial that meets the least squares criterion.
If we use a global cubic polynomial, the points are fit more closely.
If we were to continue increasing the degree of the polynomial, the residual at the data points would get smaller, but overfitting would increase.