Skip to contents

Mesh construction

Tools for converting coordinates into UTMs, constructing SPDE meshes prior to model fitting, and adding correlation barriers.

add_utm_columns() get_crs()
Add UTM coordinates to a data frame
make_mesh() plot(<sdmTMBmesh>)
Construct an SPDE mesh for sdmTMB
add_barrier_mesh()
Transform a mesh object into a mesh with correlation barriers

Fitting and predicting

Core tools for model fitting, prediction, and inspection.

sdmTMB()
Fit a spatial or spatiotemporal GLMM with TMB
sanity()
Sanity check of an sdmTMB model
tidy(<sdmTMB>)
Turn sdmTMB model output into a tidy data frame
predict(<sdmTMB>)
Predict from an sdmTMB model
residuals(<sdmTMB>)
Residuals method for sdmTMB models
dharma_residuals()
DHARMa residuals
sdmTMBcontrol()
Optimization control options
run_extra_optimization() experimental
Run extra optimization on an already fitted object
replicate_df()
Replicate a prediction data frame over time
set_delta_model()
Set delta model for ggeffects::ggpredict()
coef(<sdmTMB>)
Get fixed-effect coefficients

Families

Additional families beyond the standard R families.

Priors

Optional priors or penalties on parameters.

sdmTMBpriors() normal() halfnormal() mvnormal() pc_matern() experimental
Prior distributions
plot_pc_matern()
Plot PC Matérn priors

Simulation

Simulating new data with an sdmTMB model.

simulate(<sdmTMB>)
Simulate from a fitted sdmTMB model
sdmTMB_simulate()
Simulate from a spatial/spatiotemporal model
project() experimental
Project from an sdmTMB model using simulation

Plotting

Functions for plotting.

plot_anisotropy() plot_anisotropy2()
Plot anisotropy from an sdmTMB model
plot_smooth()
Plot a smooth term from an sdmTMB model
plot_pc_matern()
Plot PC Matérn priors
visreg_delta() visreg2d_delta()
Plot sdmTMB models with the visreg package

Cross validation

Functions related to cross validation.

sdmTMB_cv()
Cross validation with sdmTMB models
sdmTMB_stacking() experimental
Perform stacking with log scores on sdmTMB_cv() output

Derived quantities

Derived quantities that can be calculated from sdmTMB models.

get_index() get_cog() get_eao()
Extract a relative biomass/abundance index, center of gravity, or effective area occupied
get_index_sims() experimental
Calculate a population index via simulation from the joint precision matrix

Miscellaneous parameter extraction

Functions for calculating effect sizes or extracting parameter samples.

Effect.sdmTMB()
Calculate effects
emmeans.sdmTMB
Estimated marginal means with the emmeans package with sdmTMB
spread_sims() gather_sims()
Extract parameter simulations from the joint precision matrix