stgam: Spatially and Temporally Varying Coefficient Models Using Generalized Additive Models

A framework for specifying spatially, temporally and spatially-and-temporally varying coefficient models using Generalized Additive Models with smooths. The smooths are parameterised with location, time and predictor variables. The framework supports the investigation of the presence and nature of any space-time dependencies in the data by evaluating multiple model forms (specifications) using a Generalized Cross-Validation score. The workflow sequence is to: i) Prepare the data by lengthening it to have a single location and time variables for each observation. ii) Evaluate all possible spatial and/or temporal models in which each predictor is specified in different ways. iii) Evaluate each model and pick the best one. iv) Create the final model. v) Calculate the varying coefficient estimates to quantify how the relationships between the target and predictor variables vary over space, time or space-time. vi) Create maps, time series plots etc. For more details see: Comber et al (2023) <doi:10.4230/LIPIcs.GIScience.2023.22>, Comber et al (2024) <doi:10.1080/13658816.2023.2270285> and Comber et al (2004) <doi:10.3390/ijgi13120459>.

Version: 1.0.0
Depends: R (≥ 4.1.0), mgcv (≥ 1.9-1), glue
Imports: foreach, doParallel, parallel, dplyr
Suggests: cols4all, knitr, ggplot2, cowplot, purrr, rmarkdown, sf, testthat (≥ 3.0.0), tidyr
Published: 2025-05-12
DOI: 10.32614/CRAN.package.stgam
Author: Lex Comber [aut, cre], Paul Harris [ctb], Chris Brunsdon [ctb]
Maintainer: Lex Comber <a.comber at leeds.ac.uk>
BugReports: https://github.com/lexcomber/stgam/issues
License: MIT + file LICENSE
URL: https://github.com/lexcomber/stgam
NeedsCompilation: no
Materials: README NEWS
CRAN checks: stgam results

Documentation:

Reference manual: stgam.pdf
Vignettes: A geographer's introduction to space-time regression with GAMs using 'stgam' (source, R code)

Downloads:

Package source: stgam_1.0.0.tar.gz
Windows binaries: r-devel: stgam_0.0.1.2.zip, r-release: stgam_0.0.1.2.zip, r-oldrel: stgam_0.0.1.2.zip
macOS binaries: r-release (arm64): stgam_1.0.0.tgz, r-oldrel (arm64): stgam_1.0.0.tgz, r-release (x86_64): stgam_0.0.1.2.tgz, r-oldrel (x86_64): stgam_0.0.1.2.tgz
Old sources: stgam archive

Linking:

Please use the canonical form https://CRAN.R-project.org/package=stgam to link to this page.