1. Introduction
-
When fitting a model, usually we tend to minimize the residual sum of squares (RSS) to get the best fit:
where is the predicted value at .
-
However, we could always squeeze the RSS to by interpolating all the data points if there is no constraint. This would lead to overfitting.
-
Thus, apart from minimizing the RSS, we also want to be smooth. This is the idea of smoothing splines.
1.1 Smoothing Splines
Smoothing splines are to find that minimizes
where is a nonnegative tuning parameter.
- It takes the form of .
- The penalty term is a roughness penalty that penalizes the wiggliness of .
- is the second derivative of ; it measures the amount by which is not linear, or the curvature of , i.e. how fast ‘s slope is changing.
- is the integral of over the range of ; it measures the total change in the slope of over its entire range.
- If is very smooth, then is nearly constant, and is nearly , so the penalty term is small.
- If is very wiggly, then is large, and the penalty term is large.
- controls the trade-off between the two terms, i.e. the bias-variance trade-off.
- If , then it degenerates to the least squares fit, and consequently leads to interpolation.
- If , then the penalty term dominates the loss term, and will be a straight line that passes as closely as possible to the points.
It can be further proved that the solution to the above problem is a natural cubic spline with knots at each of the training observations .
2. Choosing the Smoothing Parameter
- In smoothing splines, is a tuning parameter that controls the amount of smoothing.
- As increases from to , the effective degrees of freedom decreases from to .
2.1 Effective Degrees of Freedom
Here we try to give a technical definition of effective degrees of freedom.
First, recall the notation. We want to find that minimizes
where is a nonnegative tuning parameter.
Denote the optimal given a certain as , and accordingly the predicted value as .
It can be proved that
where is a matrix that projects the response vector onto .
Finally, define the effective degrees of freedom as
2.2 Choosing by Cross-Validation
In smoothing splines, the location of the knots is fixed at the training observations. Yet we have to define the smoothing parameter .
Here we apply LOOCV (leave-one-out cross-validation) to choose , i.e. to minimize
where is the fit obtained from the original data without the th observation , and is the fit obtained from all of the original data.
The proof of the second equality is sophisticated, yet the conclusion is simple: the LOOCV error can be computed using the original fit, without having to refit for each value of .