1
Return

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

delete2025-12-01
delete1
PRE
AI
S
Sean C. Anderson *
E
Eric J. Ward
P
Philina A. English
L
Lewis A. K. Barnett
J
James T. Thorson
DOI:10.18637/jss.v115.i02delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Geostatistical spatial or spatiotemp oral 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 spatiotemp oral 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.
Keywords:
Gaussian Markov random field
GLMM
R package
spatiotemp oral model
SPDE
species distribution modeling
Template Model Builder

Journal

Journal of Statistical Software cover
Journal of Statistical Software
IF:
8.1
Papers:
616
Citations:
4.6W

Organization

N
national oceanic atmospheric admin (noaa) - usa
Scholars:
1.4W
Papers: 1.1W
Citations: 10
Cited Papers

Cited Papers

Citing Papers

Citing Papers