Documentation

24.24 GAM splines and effective degrees of freedom

The GAM learner represents continuous covariates with penalized B-splines. Defaults are basis size 8, second-order difference penalty, and 25 lambda values. A term is selected when effective degrees of freedom exceed 0.5.

GAM learner

GAM can detect nonlinear signal missed by one-column power or linear features, but needs support across the covariate range. Sparse tails can produce unstable shapes. EDF reflects complexity after smoothing; it is not a likelihood-test degree of freedom.

Use GAM as a prespecified alternative learner and plot its partial effect. A GAM selection does not automatically identify which population-model equation should be coded; translate the shape into a scientifically plausible candidate and refit it.

Common mistakes

  • Calling EDF a score-test df.
  • Interpreting a flexible curve in unsupported tails.
  • Coding the GAM curve directly without model review.
  • Comparing GAM and linear coefficients directly.
  • Adding GAM only after linear learners disagree.

Checklist

  • Review basis, penalty, lambda grid, and EDF rule.
  • Plot effects with data density.
  • Check tail and knot sensitivity.
  • Use GAM as complementary evidence.
  • Translate/refit a pharmacometric equation.

Further reading

See spline forms and algorithm agreement.