GAM (General Additive Models) are emerging as the goto approach for all kinds of data science activities. GAMS perform as well or better than most machine learning models and they are relatively fast. They are powerful and quick but critically they offer a middle ground between overly simple but interpretable standard statistical approaches, and efficient but opaque machine leaning algorithms, where it is difficult to understand how one variable relates to an outcome. Their beauty is that they can handle and model different types of statical relationships, and provide an intuitive approach for modelling relatively complex relationships in data with complex interactions and non-linearities. The outputs provide easily understood measures of the relationship between predictor and response variables, and how the outcome is modelled. Crucially for the spatial sciences, including urban planning and management, they can be adapted to generate spatial outputs that show how and where the relationship with outcome vary in space and time, in Gaussian Process (GP) splines are included in the GAM model..

This hands workshop will introduce GAMs, provide the opportunity for attendees to undertake a GAM analysis of data describing processes related to an urban informatics case study, to interpret and visualise the outputs, to apply a location aware GAM. The workshop will demonstrate how to quantify the varying spatial relationships between different driving factors and an outcome, and support users in applying a spatial GAM to their problem (please bring data!).

The workshop will have a strong hands-on element and attendees will need to have a basic understanding of R/ RStudio.

At the end of this master class attendees will:

  1. be able to apply and a tune a GAM with GP splines
  2. understand what constitutes a “good” GAM model
  3. be able to undertake spatially varying coefficient modelling using GP GAMs and interpret and visualise (map) the outputs
  4. have a robust understanding of how to apply GAMs to urban and regional systems

R scripts for each part of the workshop are provided.


Location and Time: Room 232, Leacock Building, 13:30 - 17:00, 22 June 2023

Part 1: GAM with Splines (13:30 - 15:00)

  • Talk: Welcome and introduction to GAMs (15 mins)
  • RStudio Practical:
    • Set up and Datasets
    • GAMs
    • GAMs with splines / smooths

Break (15:00 - 15:30)

Part 2: SVCs with GGP-GAMs (15:30 - 16:30)

  • Talk: Introduction to SVCs (15 mins)
  • RStudio Practical:
    • GAMs with Geographic smooths (GGP-GAM)
    • Tuning GGP-GAMs
    • Mapping and Interpreting GGP-GAM SVCs

Part 3: Wrap up (16:30)

  • Talk: GGP-GAM wrap up

RStudio refresh

The expectation is that you are familial with coding in R and the RStudio environment.

if you have not used R for a and need a refresher some good on-line get started in R guides include:

And of course there are other texts that take the reader from ‘numpty to ninja’ (i.e. ’zero to hero`):


This worksheet has shamelessly borrowed from the following resources that you may find useful:


Brunsdon, C. and Comber, L., 2018. An introduction to r for spatial analysis and mapping (2e). Sage.
Comber, L. and Brunsdon, C., 2021. Geographical data science and spatial data analysis: An introduction in r. Sage.
Lovelace, R., Nowosad, J., and Muenchow, J., 2019. Geocomputation with r. CRC Press.