A Gaussian generalised additive model with the identity link specifies
The are unknown smooth functions estimated from the data, rather than necessarily straight lines. The model is additive in their effects, so it does not automatically contain interactions between covariates. To identify the intercept separately from the smooths, impose a constraint such as for each . Linear terms can also be included alongside smooth terms. More generally a specified link function can make additive; for the normal identity-link model the mean itself has the displayed form. Smoothness is typically controlled through a basis and a roughness penalty, preventing an unrestricted smooth from interpolating all the noise.
A natural cubic spline interpolant satisfies , is twice continuously differentiable, and is a polynomial of degree at most three on each interval . Its natural boundary conditions are
If defined outside the data interval, it continues linearly on both exterior intervals. Thus function values and the first two derivatives match at the knots, but the third derivative may jump.
For an explicit construction, let and . Set and solve
On , put
This formula interpolates the values and matches second derivatives; the tridiagonal equations enforce first-derivative matching. The homogeneous system has only the zero solution: in a row with maximal nonzero , its diagonal coefficient strictly exceeds the sum of its neighbour coefficients, making cancellation impossible. Thus the natural interpolant exists uniquely.
With the convention that the residual term is a sum rather than an average, the penalised least squares criterion is
Minimize over functions whose first derivative is absolutely continuous and whose second derivative is square-integrable, that is, the usual Sobolev space . The cubic smoothing spline is its minimizer, with natural boundary conditions and linear continuation outside the data range. It is a natural cubic spline with possible knots at the observed , but usually does not interpolate the noisy .
To see why the minimizer is a natural spline, for any take the natural cubic spline interpolant through its values and write . Then . Integrating by parts on every knot interval twice gives zero: the terms involving vanish at knots, the terms involving cancel because is continuous there, and the outer terms vanish by the natural boundary conditions. Hence
while their residual sums of squares agree. Replacing by never increases the criterion. This proves the minimum roughness property of the natural cubic spline interpolant needed here.
For fitted values , write , where is positive semidefinite and has the sampled affine functions as its two-dimensional nullspace. The finite-dimensional minimization becomes . Its strictly positive definite Hessian is , so it has the unique solution
This is the roughness-matrix formula for a natural cubic smoothing spline. Larger penalizes curvature more strongly. As the fit approaches interpolation; as it approaches the ordinary least-squares affine line.
Let be the influence matrix, so . Its trace is the effective degrees of freedom, accounting for shrinkage of the fitted smooth rather than just counting basis coefficients. The generalised cross-validation score is
For a fixed smoothing parameter, the exact leave-one-out residual of this penalized linear fit is , obtained by removing its observation's contribution to the normal equations. Thus Leave-one-out cross-validation uses the average of their squared values. GCV replaces the individual leverages by their average . This avoids separate refits and gives a criterion balancing the small training residuals of a flexible fit against its larger complexity.
Evaluate the score across positive , or optimize it numerically, and choose minimizing GCV. Then refit or retain the spline at this value. In the full natural smoothing-spline family the trace decreases from towards as smoothing increases. The selected parameter is intended to give good prediction, rather than necessarily to pass through every point.
library(mgcv) loads the fitting package; gam fits a Gaussian generalised additive model with the printed identity link. The smooth specification s(x, bs="cr") uses a penalized cubic regression spline. This is a finite-dimensional smooth basis, rather than a full interpolating spline with a free value at all observations. The fitted model is
Here in the centred cubic regression-spline basis, with its curvature penalized through . The intercept is estimated separately. In the displayed fit the smooth test space has rank , consistent with nine smooth coefficients after the centring constraint, while penalization lowers its effective dimension.
The intercept estimate is , with standard error , and . Because the smooth is centred over the observations, the intercept is the overall fitted average, not necessarily the fitted response at . Its test compares this average with zero. The significance-code legend maps progressively smaller -values to stars; stars are an annotation, not an effect-size measure.
The smooth has effective degrees of freedom, displaying substantial nonlinearity: a centred purely linear term would use one. Est.rank=9 reports the rank used for its approximate significance calculation. The -value below is very strong evidence that the mean depends on , against a zero smooth term. It does not mean the fitted curve is the exact generating function, or that lack of fit has been tested. The total effective dimension including the intercept is .
The adjusted coefficient of determination of and deviance explained of indicate that nearly all variation about the response mean is explained. For this Gaussian model, deviance explained is . The scale estimate estimates residual variance, corresponding to a residual standard deviation about . The GCV score is the prediction-oriented criterion used for smoothing selection, not a probability. It is consistent with the reported scale and effective dimension: .
In the PDF's plot, the solid curve is the estimated centred smooth , and the dashed curves show pointwise uncertainty around that smooth, rather than prediction intervals for new noisy responses. The label s(x,8.24) gives its rounded effective degrees of freedom. The rug marks the observed covariate locations. Reading the endpoints gives
The smooth is increasing with an almost flat middle and one inflection, resembling a cubic. A simpler model to investigate is ordinary Gaussian polynomial regression
It uses four mean coefficients rather than about nine effective ones. The apparent near-odd shape also makes a plausible further reduction, but the linear and quadratic terms should be checked rather than discarded solely from the picture. The figure suggests this alternative; it does not supply coefficients or establish the true simulation model.

Articles by others on the same topic (0)

There are currently no matching articles.