36
8
50
47.0
47.5
48.0
48.5
0.0
0.5
1.0
1.5
Fitted values
Standardized residuals
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
Scale-Location
36
8
50
0.00
0.01
0.02
0.03
0.04
0.05
-3
-2
-1
0
1
2
3
Leverage
Standardized residuals
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
Cook's distance
Residuals vs Leverage
8
113
1
Figure 5: Diagnostic plots
(b) Then, using the same data set, fit a cubic-spline fit to the data (with temperature as the responsevariable and time as the explanatory variable), using the default amount of smoothing. Plotthe data with the cubic-spline fit superimposed and include your code in your answer.
7

Homework 6 Solutions, W2018
PSTAT 127
Page 8 of
9
dev.off()
detach(aatemp)
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
1850
1900
1950
2000
44
46
48
50
52
data(aatemp) and smoothing spline
with default smoothing parameter choice
year
temp
Figure 6: Cubic spline with default smoothing parameter choice
Side-Note: these data were collected over time, so methods for dependent data may be more appro-
priate than the methods used above; including a different method to choose the smoothing parameter
if fitting a cubic-spline related model with autocorrelated errors. However, treat this simply as an
illustrative example to explore the techniques we studied in class, realizing that you could extend
these methods into the time series context by specifying dependence in the random errors (even
though the latter extension is beyond the scope of PSTAT 127).

