19: Generalised Additive Models (GAM)
Task M
Practice Task
Work through these exercises after reading the Generalised Additive Models chapter, using the vegan oribatid mite data (data(mite); data(mite.env)), whose strong water-content gradient produces clearly nonlinear species responses. Four exercises are hands-on calculations and two are short conceptual questions.
Choose a focal mite species and fit a Poisson GAM of its count on
s(WatrCont)ands(SubsDens)withmgcv::gam(). Report the deviance explained and the estimated edf of each smooth.Plot the fitted smooths and describe the shape of the response to water content: is it monotonic, or unimodal (humped)?
Check the basis dimension with
k.check()(orgam.check()). If a smooth is under-smoothed, increase itskand refit, and report whether the conclusions change.Compare the GAM with the equivalent Poisson GLM (the same predictors as linear terms) by AIC and deviance explained. Does the added flexibility of the smooths justify its cost?
Explain what the effective degrees of freedom (edf) of a smooth represent, and how the smoothing penalty guards against overfitting.
Explain concurvity (the GAM analogue of collinearity) and why it complicates the interpretation of a model with several smooths.
Assessment Criteria
This Task is not formally assessed. It is built around four hands-on analyses (Exercises 1–4) and two short conceptual questions (Exercises 5–6); work through all six and bring your annotated Quarto document to class for discussion.
Reuse
Citation
@online{smit2026,
author = {Smit, A. J.},
title = {19: {Generalised} {Additive} {Models} {(GAM)}},
date = {2026-06-13},
url = {https://tangledbank.netlify.app/BCB743/tasks/Task_M.html},
langid = {en}
}
