sdmTMB : An R Package for Fast, Flexible, and User-Friendly Generalized Linear Mixed Effects Models with Spatial and Spatiotemporal Random Fields

Sean C. Anderson et al.

Journal of Statistical Software2025https://doi.org/10.18637/jss.v115.i02article
ABDC A
Weight
0.44

Abstract

Geostatistical spatial or spatiotemporal data are common across scientific fields. However, appropriate models to analyze these data, such as generalized linear mixed effects models (GLMMs) with Gaussian Markov random fields (GMRFs), are computationally intensive and challenging for many users to implement. Here, we introduce the R package sdmTMB, which extends the flexible interface familiar to users of lme4, glmmTMB, and mgcv to include spatial and spatiotemporal latent GMRFs using the stochastic partial differential equation (SPDE) approach. SPDE matrices are constructed with fmesher, and estimation is conducted via maximum marginal likelihood with TMB or via Bayesian inference with tmbstan and rstan. We describe the model and explore case studies that illustrate sdmTMB's flexibility in implementing penalized smoothers, non-stationary processes (time-varying and spatially varying coefficients), hurdle models, cross-validation, and anisotropy (directionally dependent spatial correlation). Finally, we compare the functionality, speed, and interfaces of related software, demonstrating that sdmTMB can be an order of magnitude faster than R-INLA. We hope sdmTMB will help open this useful class of models to more geostatistical analysts.

3 citations

Open via your library →

Cite this paper

https://doi.org/https://doi.org/10.18637/jss.v115.i02

Or copy a formatted citation

@article{sean2025,
  title        = {{sdmTMB : An R Package for Fast, Flexible, and User-Friendly Generalized Linear Mixed Effects Models with Spatial and Spatiotemporal Random Fields}},
  author       = {Sean C. Anderson et al.},
  journal      = {Journal of Statistical Software},
  year         = {2025},
  doi          = {https://doi.org/https://doi.org/10.18637/jss.v115.i02},
}

Paste directly into BibTeX, Zotero, or your reference manager.

Flag this paper

sdmTMB : An R Package for Fast, Flexible, and User-Friendly Generalized Linear Mixed Effects Models with Spatial and Spatiotemporal Random Fields

Flags are reviewed by the Arbiter methodology team within 5 business days.


Evidence weight

0.44

Balanced mode · F 0.40 / M 0.15 / V 0.05 / R 0.40

F · citation impact0.32 × 0.4 = 0.13
M · momentum0.57 × 0.15 = 0.09
V · venue signal0.50 × 0.05 = 0.03
R · text relevance †0.50 × 0.4 = 0.20

† Text relevance is estimated at 0.50 on the detail page — for your query’s actual relevance score, open this paper from a search result.