get_stitched_index: Get stitched index across survey regions in synoptic trawl...

View source: R/stitch-survey.R

get_stitched_indexR Documentation

Get stitched index across survey regions in synoptic trawl and HBLL surveys

Description

Get stitched index across survey regions in synoptic trawl and HBLL surveys

Usage

get_stitched_index(
  survey_dat,
  species = "arrowtooth flounder",
  survey_type = "synoptic",
  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 = "offset",
  priors = sdmTMB::sdmTMBpriors(),
  silent = TRUE,
  ctrl = sdmTMB::sdmTMBcontrol(nlminb_loops = 1L, newton_loops = 1L),
  gradient_thresh = 0.001,
  cache = NULL,
  check_cache = FALSE,
  cache_predictions = FALSE,
  cache_fits = FALSE,
  survey_grid = NULL,
  grid_dir
)

Arguments

survey_dat

A data frame from prep_stitch_dat().

species

A string specifying the species_common_name.

survey_type

A string matching one of: "synoptic" (the default), "hbll_outside", "hbll_inside".

model_type

A string matching one of: "st-rw" (the default), "st-rw_tv-rw", or "custom".

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

spatiotemporal

Estimate the spatiotemporal random fields, see sdmTMB::sdmTMB(). (Default is '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 if model_type = st-rw, and ~1 if model_type = 'st-rw_tv-rw'.

time_varying_type

Type of time-varying process to apply to ‘time_varying’ formula. See sdmTMB::sdmTMB(). #' Default is NULL if model_type = st-rw, and ~1 if model_type = 'st-rw_tv-rw'.

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()

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.

cache_predictions

Cache model predictions? Can be large.

cache_fits

Cache model fits? Can be large.

survey_grid

A data frame containing the spatial grid over which predictions are to be made. If survey_grid = NULL (the default). Grid should contain cell area.

grid_dir

Path where cleaned grids were stored from prep_stitch_grids()

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.