tidy.sdmTMB: Turn sdmTMB model output into a tidy data frame

View source: R/tidy.R

tidy.sdmTMBR Documentation

Turn sdmTMB model output into a tidy data frame

Description

Turn sdmTMB model output into a tidy data frame

Usage

## S3 method for class 'sdmTMB'
tidy(
  x,
  effects = c("fixed", "ran_pars", "ran_vals"),
  model = 1,
  conf.int = FALSE,
  conf.level = 0.95,
  exponentiate = FALSE,
  silent = FALSE,
  ...
)

Arguments

x

Output from sdmTMB().

effects

A character value. One of "fixed" ('fixed' or main-effect parameters), "ran_pars" (standard deviations, spatial range, and other random effect and dispersion-related terms), or "ran_vals" (individual random intercepts, if included; behaves like ranef()).

model

Which model to tidy if a delta model (1 or 2).

conf.int

Include a confidence interval?

conf.level

Confidence level for CI.

exponentiate

Whether to exponentiate the fixed-effect coefficient estimates and confidence intervals.

silent

Omit any messages?

...

Extra arguments (not used).

Details

Follows the conventions of the broom and broom.mixed packages.

Currently, effects = "ran_pars" also includes dispersion-related terms (e.g., phi), which are not actually associated with random effects.

Standard errors for spatial variance terms fit in log space (e.g., variance terms, range, or parameters associated with the observation error) are omitted to avoid confusion. Confidence intervals are still available.

Value

A data frame

Examples

fit <- sdmTMB(density ~ poly(depth_scaled, 2, raw = TRUE),
  data = pcod_2011, mesh = pcod_mesh_2011,
  family = tweedie()
)
tidy(fit)
tidy(fit, conf.int = TRUE)
tidy(fit, "ran_pars", conf.int = TRUE)

pcod_2011$fyear <- as.factor(pcod_2011$year)
fit <- sdmTMB(density ~ poly(depth_scaled, 2, raw = TRUE) + (1 | fyear),
  data = pcod_2011, mesh = pcod_mesh_2011,
  family = tweedie()
)
tidy(fit, "ran_vals")

sdmTMB documentation built on June 22, 2024, 10:48 a.m.