The smoothing spline minimises ∑(yi − g(xi))2 + λ∫g″(t)2dt (7.11). Its fitted values are Sλy (7.12), and the effective degrees of freedom are tr Sλ (7.13). Because the fit is linear in y, every leave-one-out residual is the ordinary residual divided by 1 − {Sλ}ii: the whole cross-validation curve below costs one fit per λ. The bottom panel shows the weights the fit at one age gives to the mean wage at every age.
The 3000 men have only 61 distinct ages, so the spline is computed on the age means, weighted by the number of men of each age, in Reinsch form ĝ = (W + λK)−1Wȳ with K = QR−1QT. This is the exact minimiser of (7.11), with a knot at every distinct age; λ is in units of wage2 × years3. The leave-one-out error is for single men, not for whole ages.
code/ch07_lab.py (SmoothSpline: df, lam_for_df, loocv) and R's smooth.spline() in ch07_lab.R.