£400Registration Fee
Register Now- Overview
- Instructors
- Schedule
Course Description
Biological data are often hierarchical: observations are grouped within individuals, populations, species, sites, treatments, or studies, while relationships with predictors may be nonlinear. Hierarchical generalized additive models (HGAMs) provide a flexible framework for modelling these structures by combining smooth functions with partial pooling and random effects.
In this practical online course, participants will learn how to specify, fit, check, interpret, and visualize HGAMs in R using mgcv. Building on Pedersen et al. (2019), the course covers shared trends and group-specific deviations, alternative approaches to factor–smooth interactions, and choosing an appropriate hierarchical structure. It also introduces important recent developments, including sum-to-zero (“sz”) smooths, hierarchies with more than two levels—for example, global, treatment, and subject-specific smooths. We will also explore models that allow response distributions or dispersion parameters to vary among groups, using gfam() and location–scale–shape models.
Examples will be drawn from across the biological sciences, making the course relevant to researchers working with ecological, environmental, animal, veterinary, agricultural, and other biological data.
Each 75-minute session will combine approximately 35–45 minutes of explanation or live coding, 20–30 minutes of guided practical work, and time for discussion and questions.
Supporting paper; Pedersen, E.J., Miller, D.L., Simpson, G.L., Ross, N., 2019. Hierarchical generalized additive models in ecology: an introduction with mgcv. PeerJ 7, e6876. https://doi.org/10.7717/peerj.6876
What You’ll Learn
- Recognize hierarchical structure in biological data and determine when an HGAM is appropriate.
- Specify and fit hierarchical GAMs in R using mgcv.
- Model shared nonlinear trends alongside group-, species-, treatment-, or subject-specific deviations.
- Choose between alternative factor–smooth constructions, including sum-to-zero (“sz”) smooths.
- Build models with multiple levels of hierarchy, such as global, treatment-level, and individual-level smooths.
- Model differences in response distributions or dispersion among groups using gfam() and location–scale–shape models.
- Evaluate, interpret, compare, and visualize fitted HGAMs and their component smooths.
Course Format
Interactive Learning Format
Global Accessibility
Collaborative Discussions
Comprehensive Course Materials
All code, datasets, and presentation slides used during the course will be shared with participants by the instructor.
Personalized Data Engagement
Post-Course Support
Who Should Attend / Intended Audiences
This course is designed for graduate students, postdoctoral researchers, and researchers working in academia or industry who want to apply hierarchical generalized additive models to complex biological data. Participants should have some prior experience using R and a basic understanding of statistical concepts such as regression, model assumptions, and uncertainty. Some familiarity with generalized additive models (GAMs) is strongly recommended, as the course will build on core GAM concepts rather than introduce them from first principles.
Equipment and Software requirements
A laptop or desktop computer with a functioning installation of R and RStudio is required. Both R and RStudio are free, open-source programs compatible with Windows, macOS, and Linux systems.
A working webcam is recommended to support interactive elements of the course. We encourage participants to keep their cameras on during live Zoom sessions to foster a more engaging and collaborative environment.
While not essential, using a large monitor—or ideally a dual-monitor setup—can significantly enhance your learning experience by allowing you to view course materials and work in R simultaneously.
All necessary R packages will be introduced and installed during the workshop. A comprehensive list of required packages will also be shared with participants ahead of the course to allow for optional pre-installation.
Dr. Gavin Simpson
Gavin Simpson is an applied statistician, ecologist, and educator with extensive experience in Bayesian statistics, ecological modelling, and reproducible data analysis using R. His work focuses on helping researchers and analysts apply modern statistical methods to complex real-world data, combining deep methodological expertise with a practical, applied approach to teaching and consultancy.
His core expertise includes Generalised Additive Models (GAMs), Bayesian statistical modelling, multivariate analysis, and ecological statistics. Gavin is widely recognised for his work with the R packages mgcv, gratia, vegan, and related statistical workflows, and has contributed extensively to statistical training for academic, environmental, and research organisations internationally.
Gavin has worked across a range of disciplines including ecology, environmental science, palaeoecology, and applied data science, supporting researchers in developing robust and interpretable statistical models. He is particularly known for making advanced statistical techniques accessible to applied researchers through clear explanation, reproducible workflows, and hands-on training.
Education & Career
· PhD in Quantitative Palaeoecology (UCL, Geography)
· Senior statistician and quantitative ecologist
· Extensive experience teaching statistical modelling and R programming internationally
· Specialist in Generalised Additive Models (GAMs) and multivariate methods
· Contributor to open-source statistical software and reproducible research practices
Research & Professional Focus
Gavin’s research integrates statistical modelling to investigate complex datasets—including microbiome, metabolomics, and ecological data—and to develop innovative analytical approaches for animal production systems. I am particularly interested in temporal dynamics, with an emphasis on quantifying and forecasting system-level changes over time.
Current projects
· Development of R packages for working with GAMs, fitting and visualising multivariate ordinations, and creating restricted permutations
· Applications of GAMs and distributional models in animal and veterinary sciences
· Estimating temporal changes in variance of ecological time series
· Dimension reduction and analysis of high dimensional palaeoecolgoical time series
Professional Consultancy
Gavin works with universities, research institutes, environmental organisations, and businesses to develop statistical methodologies, improve analytical workflows, and support applied quantitative research. His consultancy includes ecological modelling, Bayesian analysis, and advanced regression techniques for complex datasets.
Teaching & Skills
· Specialist in Generalised Additive Models (GAMs), mixed models, data science and applied statistics
· Experienced trainer in R, and reproducible statistical workflows
· Strong focus on model interpretation, diagnostics, and practical application
· Advocate for open-source statistical software and transparent, reproducible research practices
Session 1 – 01:15:00 – Why hierarchical GAMs?
Hierarchical structure in biological data; review of smooths, penalties, smoothing parameters, shrinkage and partial pooling.
Session 2 – 01:15:00 – The essential mgcv workflow.
Specifying, fitting, visualizing and interpreting a standard GAM; basis dimensions and REML estimation.
15:00–15:30 Break – 00:30:00
Session 3 – 01:15:00 – Introducing HGAMs.
Global smooths, group-specific smooths, shared and separate smoothing parameters, and the principal model structures from the original HGAM paper.
Session 4 – 01:15:00 – Practical 1.
Fit and compare a sequence of GAMs and HGAMs for grouped biological data. Interpret the global and group-specific components.
Session 5 – 01:15:00 – Factor–smooth interactions.
Factor by smooths, linked smoothing parameters and the “fs” basis; what each construction assumes.
Session 6 – 01:15:00 – Sum-to-zero smooths.
Using the “sz” basis to represent a global smooth plus identifiable group-specific deviations.
Break – 00:30:00
Session 7 – 01:15:00 – Choosing an HGAM structure.
Common versus group-specific trends, different degrees of pooling, model complexity and biological interpretation.
Session 8 – 01:15:00 – Practical 2.
Fit, and visualize alternative HGAM structures for species-, treatment- or subject-specific trajectories.
Session 9 – 01:15:00 – More than two hierarchical levels.
Constructing models with global, treatment-level and subject-level smooths.
Session 10 – 01:15:00 – Smooths, penalties and random effects.
The equivalence between penalized smooths and Gaussian random effects; smoothing parameters as variance components; a brief introduction to simple random-effect smooths in mgcv.
Break – 00:30:00
Session 11 – 01:15:00 – Different distributions among groups.
Using gfam() when observations or groups require different response distributions or dispersion parameters.
Session 12 – 01:15:00 – Distributional models.
Introducing location–scale–shape models in which smooth effects may be specified for more than the conditional mean, followed by a guided practical.
Session 13 – 01:15:00 – Checking HGAMs.
Residual diagnostics, basis-dimension checking, concurvity, distributional assumptions, heterogeneity and residual dependence.
Session 14 – 01:15:00 – Inference and communication.
Predictions, uncertainty intervals, comparisons between smooths, response-scale summaries and effective visualization of complex models.
Break – 00:30:00
Session 15 – 01:15:00 – Integrated case study.
Translate a biological question and sampling design into candidate models; fit, compare, diagnose and refine the models.
Session 16 – 01:15:00 – Model-building workshop and review.
Participants develop and interpret an HGAM, discuss their choices, troubleshoot common problems and consolidate a reusable modelling workflow.
Frequently asked questions
Everything you need to know about the product and billing.
When will I receive instructions on how to join?
You’ll receive an email on the Friday before the course begins, with full instructions on how to join via Zoom. Please ensure you have Zoom installed in advance.
Do I need administrator rights on my computer?
I’m attending the course live — will I also get access to the session recordings?
I can’t attend every live session — can I join some sessions live and catch up on others later?
I’m in a different time zone and plan to follow the course via recordings. When will these be available?
I can’t attend live — how can I ask questions?
Will I receive a certificate?
When will I receive instructions on how to join?
You’ll receive an email on the Friday before the course begins, with full instructions on how to join via Zoom. Please ensure you have Zoom installed in advance.
Do I need administrator rights on my computer?
I’m attending the course live — will I also get access to the session recordings?
I can’t attend every live session — can I join some sessions live and catch up on others later?
I’m in a different time zone and plan to follow the course via recordings. When will these be available?
I can’t attend live — how can I ask questions?
Will I receive a certificate?
Still have questions?
Can’t find the answer you’re looking for? Please chat to our friendly team.








