Skip to contents

Helper function to amend a vector of parameter names or hierarchical level shortcuts.

Usage

include_pars(
  pars,
  stan_model,
  SR_fun,
  RRS,
  par_models,
  include,
  log_lik = FALSE
)

Arguments

pars

A character vector specifying (hyper)parameters, states, and/or quantities of interest ("parameters"). Parameters can be explicitly named or one or more shortcuts can be used to specify hierarchical levels of parameters; see stan_pars() for details.

stan_model

Character string specifying the salmonIPM model to be fit. A more concise alternative to specifying model, life_cycle, and pool_pops and will override those arguments.

SR_fun

One of "exp" (density-independent discrete exponential), "BH" (Beverton-Holt, the default), or "Ricker", indicating which spawner-recruit function to fit. Synonyms "DI", "B-H", "bh", "b-h" and "ricker" are accepted.

RRS

A character string or vector of strings naming parameters of the function specified by SR_fun that differ between wild- and hatchery-origin spawners, such that the relative reproductive success of hatchery spawners is not equal to 1. If pool_pops == TRUE, these should be the names of the population-specific parameters, not their hyper-means. For example, if life_cycle %in% c("SS","SSiter"), the options are "none" (the default), "alpha", "Rmax", or c("alpha","Rmax"). Currently RRS is only implemented for pool_pops == FALSE.

par_models

Optional list of two-sided formulas of the form theta ~ x1 + ... + xK, where theta is a (hyper)parameter or state in the model specified by stan_model that accepts covariates (see Details for available model-parameter combinations) and x1 + ... + xK are terms involving variables in fish_data. Standard formula syntax such as : and * may be used; see stats::formula().

include

Logical scalar defaulting to TRUE indicating whether to include or exclude the parameters given by pars.

log_lik

Logical scalar indicating whether the pointwise log-likelihood should be saved, e.g. for later use with loo::loo().

Value

A character vector of amended pars.