Spline Tuning and Uncertainty
The smoothing parameter determines how much curvature the estimate can use. Selecting it and describing the uncertainty of the resulting curve are separate tasks. A visually smooth fit can still be biased, and a narrow interval need not account for that bias.
The smoother matrix¶
For a fixed basis and penalty parameter, write
The effective degrees of freedom are . This measures how responsive the fitted values are to the observed responses. It need not equal the number of basis coefficients.
At small penalties, df approaches the rank of the unpenalized design. At large penalties, it approaches the dimension of the identifiable penalty nullspace. For the usual curvature penalty with an identifiable intercept and slope, that limit is two.
Validation criteria¶
Using the same fixed basis and the same numerical penalty in each omitted fit, the linear smoother identity gives
The denominators must be nonzero and the omitted fitting problems must remain well defined. If preprocessing or basis construction is learned again in each fold, evaluate that complete procedure directly rather than assuming this shortcut still applies.
Generalized cross validation replaces individual leverages by their average:
Search over a range of penalties. If the best score lies at the edge, examine whether the range was adequate. A low score obtained after searching is a selection result; independent assessment still requires a reserved test sample or an outer validation loop.
Sampling variation of the curve¶
Assume the true mean is and set . Then
The covariance is not simply . The middle appears because the random part enters through .
At a new input ,
For normal errors and fixed , this is the exact sampling variance around the expectation of the smoothed estimate. The expectation can differ from the true curve because of shrinkage or an insufficient basis.
What an interval includes¶
A displayed band of the form is a pointwise approximation for the mean curve when smoothing bias is negligible. It is not automatically a simultaneous 95 percent band across every .
Predicting a new response adds its noise variance. With independent future errors, the variance around the expected prediction error includes the estimation variance plus . Neither calculation automatically includes uncertainty from selecting on the same sample.
Estimating the noise variance¶
The lecture uses residual error with an effective degrees of freedom adjustment. For a fixed smoother and true mean , the exact expectation is
For ordinary least squares with the correct mean space, the bias term vanishes and , recovering the familiar residual degrees of freedom. For a penalized spline neither simplification generally holds. Dividing RSS by is therefore a working adjustment, not a general proof of unbiasedness.