update.sdmTMB: Update an sdmTMB model

View source: R/methods.R

update.sdmTMBR Documentation

Update an sdmTMB model

Description

This method updates an sdmTMB model with new arguments while automatically handling the mesh object to avoid environment issues when loading models from saved files.

Usage

## S3 method for class 'sdmTMB'
update(object, formula., ..., evaluate = TRUE)

Arguments

object

An sdmTMB model object.

formula.

Optional updated formula.

...

Other arguments to update in the model call.

evaluate

If TRUE (default), the updated call is evaluated; if FALSE, the call is returned unevaluated.

Details

Unless control is supplied, the updated model reuses the fitted model's sdmTMBcontrol() settings, including its backend, regardless of the current sdmTMB.backend option. A supplied control replaces these settings, including the backend (e.g., update(fit, control = sdmTMBcontrol(backend = "rtmb"))).

Value

An updated sdmTMB model object (if evaluate = TRUE) or an unevaluated call (if evaluate = FALSE).

Examples

mesh <- make_mesh(pcod_2011, c("X", "Y"), cutoff = 20)
fit <- sdmTMB(density ~ 1, data = pcod_2011, mesh = mesh,
  family = tweedie(link = "log"))
fit2 <- update(fit, family = delta_gamma())

sdmTMB documentation built on Oct. 17, 2026, 1:07 a.m.