Introduction to the workshop

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, where and when the relationship with outcome vary in space and time. .

This hands workshop will introduce GAMs, provide the opportunity for attendees to undertake a space-time GAM analysis of data describing processes related to an productivity 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 will support users in applying a space-time 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 workshop attendees will

  1. understand the relative advantages of the General Additive Model family
  2. be able to apply GAMs to spatio-temporal data, interpret and visualise the outputs
  3. be able to use GAMs for prediction (what if scenarios) and inference (system or process understanding)

R scripts for each part of the workshop are provided.


Part 1: GAM with Splines (14:00 - 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 - 17:00)

  • Talk: Introduction to spatially and temporally varying coefficient models (15 mins)
  • RStudio Practical:
    • GAMs with Spatial and Temporal smooths
    • Mapping and Interpreting SVC / TVC and STVC GAM model outputs
    • Thinking critically about your space time model
  • Talk: GGP-GAM wrap up (maybe!)

RStudio refresh

The expectation is that you are familiar 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, Chris, and Lex Comber. 2018. “An Introduction to r for Spatial Analysis and Mapping.”
Comber, Lex, and Chris Brunsdon. 2020. Geographical Data Science and Spatial Data Analysis: An Introduction in r. Sage.
Lovelace, Robin, Jakub Nowosad, and Jannes Muenchow. 2019. Geocomputation with r. Chapman; Hall/CRC.