Cubic regression spline (source code)

= Cubic regression spline
{title2=$f(x)=\sum_jc_jB_j(x)$}

A cubic regression spline represents a mean function in a finite-dimensional space of piecewise cubic functions, with continuity of the function and its first two derivatives at chosen knots. A penalized fit minimizes a residual criterion plus $\lambda\int(f'')^2$, using $\Omega_{jk}=\int B_j''B_k''$. Unlike a full <cubic smoothing spline> with knots at every distinct observation, its knot set can be much smaller. The `mgcv` basis `bs="cr"` uses a penalized natural cubic regression-spline basis with linear tails.