GAM — Generalized Additive Model (non-linear spline regression)

Coming soon

Advanced & 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 now

Semi-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.

Result

The smooth age term was strongly non-linear (effective df = 9.0, Wald χ² = 1,213, p < .001); risk was U-shaped in age.

How you'd report it (APA)

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 relationships
    Predicting hospital length-of-stay from age, BMI, and admission severity.
  • Exposure-response / dose-response curve estimation
    Air-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

Hypotheses

H₀: the model does not improve over the null (intercept-only).
Hₐ: at least one smooth is non-zero.

Parameter tested: Smooth terms f_j with per-term EDF + deviance explained.

Assumptions (and what to do if they fail)

B-spline basis adequately captures non-linearity (default: 10 knots, degree 3).medium

Check: AIC_gam < AIC_linear.

If violated: Under-smoothed ⇒ wiggly; over-smoothed ⇒ linear.

No single observation dominates the smooth fit.low

Check: Max Cook's D.

If violated: Outliers distort smooth curves.

Observations are independent (no clustering).high

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 →