Turn sdmTMB model output into a tidy data frame

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

Arguments

x

Output from sdmTMB().

effects

A character vector including one or more of "fixed" (fixed-effect parameters), "ran_pars" (standard deviations, spatial range, and other random effect and dispersion terms), or "ranef" (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.

...

Extra arguments (not used).

Value

A data frame

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 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.

Examples

fit <- sdmTMB(density ~ poly(depth_scaled, 2, raw = TRUE),
  data = pcod_2011, mesh = pcod_mesh_2011,
  family = tweedie()
)
tidy(fit)
#>                                 term  estimate std.error
#> 1                        (Intercept)  3.649391 0.2813973
#> 2 poly(depth_scaled, 2, raw = TRUE)1 -1.538960 0.1859669
#> 3 poly(depth_scaled, 2, raw = TRUE)2 -1.111444 0.1013527
tidy(fit, conf.int = TRUE)
#>                                 term  estimate std.error  conf.low conf.high
#> 1                        (Intercept)  3.649391 0.2813973  3.097862  4.200920
#> 2 poly(depth_scaled, 2, raw = TRUE)1 -1.538960 0.1859669 -1.903449 -1.174472
#> 3 poly(depth_scaled, 2, raw = TRUE)2 -1.111444 0.1013527 -1.310091 -0.912796
tidy(fit, "ran_pars", conf.int = TRUE)
#>        term  estimate std.error   conf.low conf.high
#> 1     range 19.137003        NA  4.5803807 79.955116
#> 3       phi 14.047899        NA 12.7824400 15.438638
#> 4   sigma_O  2.141805        NA  0.9056509  5.065228
#> 5 tweedie_p  1.580328        NA  1.5501157  1.609950