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
predict(<sdmTMB>)
Predict from an sdmTMB model
tidy(<sdmTMB>)
Turn sdmTMB model output into a tidy data frame
sanity()
Sanity check of an sdmTMB model
sdmTMBcontrol()
Optimization control options
run_extra_optimization()
Run extra optimization on an already fitted object
residuals(<sdmTMB>)
Residuals method for sdmTMB models
dharma_residuals()
DHARMa residuals
replicate_df()
Replicate a prediction data frame over time
set_delta_model()
Set delta model for ggeffects::ggpredict()

Families

Additional families beyond the standard R families.

Priors

Optional priors or penalties on parameters.

sdmTMBpriors() normal() halfnormal() mvnormal() pc_matern()
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

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()
Perform stacking with log scores on sdmTMB_cv() output

Derived quantities

Derived quantities that can be calculated from sdmTMB models.

get_index() get_cog()
Extract a relative biomass/abundance index or a center of gravity
get_index_sims()
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