Modelling Space and Time with GAMS: spatially and temporally varying coefficient models
May 2023
Overview
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
- understand the relative advantages of the General Additive Model family
- be able to apply GAMs to spatio-temporal data, interpret and visualise the outputs
- 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.
Schedule
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:
- The introduction to my 3rd year under-graduate module: https://bookdown.org/lexcomber/GEOG3195/#r-refresh-if-you-have-not-used-r-before
- The Owen guide (only up to page 28): https://cran.r-project.org/doc/contrib/Owen-TheRGuide.pdf
- An Introduction to R - https://cran.r-project.org/doc/contrib/Lam-IntroductionToR_LHL.pdf
- R for beginners https://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
And of course there are other texts that take the reader from ‘numpty to ninja’ (i.e. ’zero to hero`):
- Lovelace, Nowosad, and Muenchow (2019): https://bookdown.org/robinlovelace/geocompr/
- Comber and Brunsdon (2020), provide a through grounding of the spatial analysis in R and the code for each chapter is here: https://study.sagepub.com/comber/student-resources/code-library
- Brunsdon and Comber (2018), provides a comprehensive introduction to R and for spatial data analytics: https://uk.sagepub.com/en-gb/eur/an-introduction-to-r-for-spatial-analysis-and-mapping/book258267.
Acknowldgements
This worksheet has shamelessly borrowed from the following resources that you may find useful:
- GAM: The Predictive Modeling Silver Bullet by Kim Larsen - https://multithreaded.stitchfix.com/blog/2015/07/30/gam/
- Generalized Additive Models by Michael Clark - https://m-clark.github.io/generalized-additive-models/