get_iphc_stitched_index: Get index using 'sdmTMB' for IPHC surveys

View source: R/stitch-iphc.R

get_iphc_stitched_indexR Documentation

Get index using sdmTMB for IPHC surveys

Description

Get index using sdmTMB for IPHC surveys

Usage

get_iphc_stitched_index(
  survey_dat,
  species,
  model_type = "st-rw",
  form = NULL,
  family = sdmTMB::tweedie(),
  time = "year",
  spatial = "on",
  spatiotemporal = "rw",
  time_varying = NULL,
  time_varying_type = NULL,
  mesh = NULL,
  cutoff = 20,
  offset = "log_eff_skate",
  priors = sdmTMB::sdmTMBpriors(),
  silent = TRUE,
  ctrl = sdmTMB::sdmTMBcontrol(),
  gradient_thresh = 0.001,
  cache = NULL,
  check_cache = FALSE,
  grid
)

Arguments

survey_dat

A data frame from prep_iphc_stitch_dat().

species

A string specifying the species_common_name.

model_type

An suffix to the filename indicating model type (default = "st-rw").

form

Optional string specifying model formula. 'catch ~ 1' (the default, unless family = poisson() or family = sdmTMB::censored_possion() then "catch ~ 1 + (1|obs_id)").

family

The family and link for sdmTMB::sdmTMB().

time

An optional time column name (as character), used in sdmTMB::sdmTMB(). (default = 'year')

spatial

Estimate spatial random fields? See sdmTMB::sdmTMB(). Default is 'rw' if 'model_type = "st-rw" or "st-rw_tv-rw".

spatiotemporal

Estimate the spatiotemporal random fields, see sdmTMB::sdmTMB(). Default is 'rw' if 'model_type = "st-rw" or "st-rw_tv-rw".

time_varying

An optional one-sided formula describing covariates that should be modelled as a time-varying process. See sdmTMB::sdmTMB(). Default is NULL.

time_varying_type

Type of time-varying process to apply to ‘time_varying’ formula. See sdmTMB::sdmTMB(). Default is NULL.

mesh

Optional mesh object created using sdmTMB::make_mesh().

cutoff

If mesh = NULL, mesh cutoff for sdmTMB::make_mesh().

offset

A string naming the offset column in dat used in sdmTMB::sdmTMB() (default = 'log_eff_skate').

priors

Optional penalties/priors used in sdmTMB::sdmTMBpriors().

silent

A boolean. Silent or include optimization details.

ctrl

Optimization control options via sdmTMB::sdmTMBcontrol().

gradient_thresh

Threshold used in sdmTMB::sanity() (default = 0.001).

cache

A string specifying file path to cache directory.

check_cache

Check whether index file already exists? Default = FALSE.

grid

A data frame containing the locations of IPHC stations used to make predictions and generate the index.

Value

Either a string or dataframe:

  • ⁠insufficient data to stitch regions⁠ if the number of positive sets is too low to stitch

  • ⁠Failed sanity check⁠ if the model failed to converge

  • A dataframe containing the stitched index formatted to use with gfplot::plot_survey_index()


pbs-assess/gfsynopsis documentation built on March 26, 2024, 7:30 p.m.