Skip to content

Generalised additive model

A GAM adds smooth predictor effects on a link scale. See how response links, centering, smoothing penalties and interactions shape its interpretation.

A generalised additive model (GAM) models a response through a sum of smooth predictor functions, linked to its conditional mean. For a quant modelling trade arrivals or a nonlinear risk signal, it permits curved relationships while keeping individual model contributions visible.
In the familiar extension of a generalised linear model, write
g(μi)=ηi=β0+∑j=1pfj(xij),μi=E[Yi∣xi].g(\mu_i)=\eta_i=\beta_0+\sum_{j=1}^{p}f_j(x_{ij}), \qquad \mu_i=\mathbb{E}[Y_i\mid\mathbf{x}_i].
Here gg is the link, ηi\eta_i is the additive predictor, and each fjf_j is a smooth function learned from data. A function can curve, flatten or reverse slope. Some predictors can retain ordinary linear terms. The response family supplies distributional assumptions beyond this mean equation. Hastie and Tibshirani's original paper develops the additive construction and iterative estimation.

Suppose the intercept is 11 and two smooths contribute 0.30.3 and 0.20.2 at a particular predictor combination. Then

η=1+0.3+0.2=1.5.\eta=1+0.3+0.2=1.5.

That score becomes a response mean only after specifying a family and link:

Separate illustrative specificationConditional mean at this score
Gaussian response with identity linkμ=η=1.5\mu=\eta=1.5 response units
Poisson trade count with log link, fixed observation windowμ=eη=e1.5≈4.4817\mu=e^{\eta}=e^{1.5}\approx4.4817 expected trades
These are two specified models, each assigned the same contributions for illustration. Changing the family or link and refitting data generally changes the estimated functions too. The fractional Poisson mean is an expected count, not a possible realised trade count. The R family documentation distinguishes family and link choices.
Synthetic GAM waterfall: intercept 1, smooth contribution 0.3 and smooth contribution 0.2 give a link-scale score of 1.5. Separate Gaussian identity-link and Poisson log-link specifications give means of 1.5 response units and 4.4817 expected events per window.
Synthetic GAM waterfall: intercept 1, smooth contribution 0.3 and smooth contribution 0.2 give a link-scale score of 1.5. Separate Gaussian identity-link and Poisson log-link specifications give means of 1.5 response units and 4.4817 expected events per window.
Original stipulated example, not a fitted dataset. Additivity describes the predictor; the inverse link determines how that predictor becomes a conditional mean. The two response specifications need not produce the same fitted terms when estimated.

With a log link, a 0.20.2 increase in one smooth, holding the other terms fixed, multiplies the mean by e0.2≈1.2214e^{0.2}\approx1.2214. It does not add 0.20.2 trades. The absolute change in the mean depends on the starting mean even when the predictor is additive. Also, the model concerns the log of the conditional mean, not the conditional mean of logged observations.

Smooth does not mean unconstrained

A common implementation represents each curve with spline basis functions and fits their coefficients jointly. One penalised-likelihood formulation minimises

−ℓ(θ)+12∑jλjJ(fj),-\ell(\boldsymbol{\theta}) +\frac12\sum_j\lambda_j J(f_j),

where ℓ\ell is the response log likelihood, θ\boldsymbol{\theta} collects the coefficients, JJ measures roughness, and λj≥0\lambda_j\ge0 controls the fit–smoothness trade-off. For a suitable twice-differentiable univariate curve, a familiar penalty is J(fj)=∫{fj′′(u)}2 duJ(f_j)=\int\{f_j''(u)\}^2\,du.

Larger penalties discourage wiggles; they do not necessarily eliminate an entire term, because some function components can escape a particular penalty. A sufficiently rich basis still needs regularisation against overfitting; an undersized basis can prevent useful curvature even with a small penalty. Smoothing parameters may be selected using criteria such as REML or generalised cross-validation. These are modelling choices, not guarantees of forecast quality. Wood's fitting documentation explains this construction and its limits.
The curves are not separate regressions of the response on each predictor. In backfitting, each curve is updated using residuals after the current contributions of the others have been removed; updates repeat. Penalised spline methods likewise estimate a combined model. This matters when predictors overlap in what they explain. Hastie and Tibshirani, §7.

Why component plots are centred

Without a constraint, adding a constant to a smooth and subtracting it from the intercept leaves every prediction unchanged. For the example, replacing the intercept 11 by 0.90.9 and the first contribution 0.30.3 by 0.40.4 still gives η=1.5\eta=1.5.

A common identification convention imposes

∑i=1nfj(xij)=0\sum_{i=1}^{n} f_j(x_{ij})=0
on each ordinary smooth over the training observations. The intercept then carries the overall level on the link scale. This is a centering convention, not evidence that a zero crossing is an economic threshold. Some smooth types require different constraints. Wood's identifiability documentation states these exceptions.
A component curve usually shows a centred contribution on the linear-predictor scale, rather than the predicted response or its stand-alone expectation. Exponentiating one component in a multivariable log-link model gives a multiplicative factor, not the complete mean. The plotting documentation describes the scale and uncertainty conventions.

What the additive restriction leaves out

The univariate sum above contains no interaction: the change in f1f_1 does not depend on the value of the second predictor. If momentum's contribution on the link scale changes with volatility, the model may need an explicit smooth interaction such as f12(x1,x2)f_{12}(x_1,x_2). GAM frameworks can include such multivariable terms, with suitable constraints and penalties. They remain structured models, though a one-dimensional curve no longer describes the whole effect of either interacting variable. Wood's model specification guide distinguishes main effects and interactions.
Smooth terms can also mimic one another when predictors are related. This concurvity can make the allocation between component curves unstable even when aggregate predictions look reasonable. Centering alone does not fix it. Wood's concurvity documentation explains this generalisation of collinearity.

A visible curve describes the fitted conditional association under the chosen model. It does not establish what would happen if a trader intervened on that predictor: confounding, selection and reverse causation require a separate causal argument.

For the curve-building background, see the SelfMadeQuant lesson Beyond Linearity: Splines, Local Regression, and Generalized Additive Models. For the response-family foundation, see The Exponential Family and Generalized Linear Models. Both have public previews; full lessons require membership.

Sources

Last updated
  • gam
  • smooth functions
  • link function
  • penalised regression
  • interpretability
← Back to the glossaryBack to top ↑