GAM — Generalized Additive Model (non-linear spline regression)
Coming soonAdvanced & specialized
This test is implemented and is currently going through StatMinds’ production verification: every statistic is independently checked against a trusted reference (scipy / R), locked with regression tests, and the screen is exercised across assumption-met/violated and significant/non-significant scenarios before it opens up.
See what’s live nowSemi-parametric regression modelling the outcome as a sum of smooth functions of each predictor: g(E[Y]) = β₀ + Σ f_j(X_j).
The smooths f_j are penalised B-splines (Wood 2017) with automatic effective-degrees-of-freedom selection via REML, so each predictor's functional form is data-driven (linear / quadratic / S-shaped / wavy as the data demands). Reports per-smooth edf, F-test, partial-effect plot, and overall deviance explained. The natural tool when X-Y relationships are clearly non-linear AND interpretability of each predictor's curve matters more than raw predictive accuracy.
Worked example
Is the effect of age on risk non-linear?
A generalised additive model fits age as a smooth curve rather than a straight line, letting the data reveal the shape of the relationship.
The smooth age term was strongly non-linear (effective df = 9.0, Wald χ² = 1,213, p < .001); risk was U-shaped in age.
A GAM showed a significant non-linear effect of age on risk (effective df = 9.0, Wald χ² = 1,213, p < .001).
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- Continuous predictors with non-linear relationshipsPredicting hospital length-of-stay from age, BMI, and admission severity.
- Exposure-response / dose-response curve estimationAir-pollution epidemiology: estimate the smooth association between PM2.5 concentration and daily mortality count, adjusting for temperature (also smooth), day-of-week, and seasona
When NOT to — use instead
- Linear relationships onlyIf X-Y is linear, standard linear regression is more interpretable and powerful. → Linear Regression \u2014 OLS (continuous y + predictors)
- Small sample (n < 50)GAM needs enough data to fit smooths reliably; with tiny n the smoothing breaks down. → Linear Regression \u2014 OLS (continuous y + predictors)
- Pure prediction with many predictorsWhen the goal is pure out-of-sample prediction, tree ensembles often outperform GAM.
- Strong predictor-predictor interactionsAdditive GAM doesn't model interactions natively. → Moderation (2-level Mod \u00d7 continuous IV) \u2014 interaction + simple slopes
Hypotheses
Parameter tested: Smooth terms f_j with per-term EDF + deviance explained.
Assumptions (and what to do if they fail)
Check: AIC_gam < AIC_linear.
If violated: Under-smoothed ⇒ wiggly; over-smoothed ⇒ linear.
Check: Max Cook's D.
If violated: Outliers distort smooth curves.
Check: One row per subject.
If violated: Clustered residuals inflate precision.
Ready to run a GAM — Generalized Additive Model (non-linear spline regression) on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →