Skip to contents

Bayesian stock reconstruction model of natural and hatchery origin fish, fitted to coded wire tag data, observed escapement, and hatchery releases (Korman and Walters 2024). Estimates time-varying maturity rate as well as time-varying ocean survival as a linear model of covariates (separate covariates assumed between age 1 vs. ages 2+). The model includes either a preterminal fishery, terminal fishery, or both (see Data and start sections of the documentation). fit_CM() generates the RTMB model from data which can then be passed to sample_CM() to run the MCMC in Stan.

Usage

fit_CM(
  data,
  start = list(),
  lower = list(),
  upper = list(),
  do_fit = TRUE,
  silent = TRUE,
  control = list(eval.max = 1e+05, iter.max = 1e+05),
  ...
)

sample_CM(fit, ...)

Arguments

data

A list containing data inputs. See details.

start

An optional list containing parameter starting values. See details.

lower

Named list containing lower bounds for parameters. See details.

upper

Named list containing upper bounds for parameters. See details.

do_fit

Logical, whether to do the fit and estimate the Hessian.

silent

Logical, whether to silence output from RTMB to the console.

control

List, control argument to pass to stats::nlminb().

...

For fit_CM, arguments to RTMB::MakeADFun(). For sample_CM, arguments to rstan::sampling()

fit

List of output from fit_CM()

Value

  • fit_CM() returns a named list containing the RTMB model (obj), nlminb output (opt), standard errors (SD), and parameter bounds (lower and upper)

  • sample_CM() returns a stanfit object containing the MCMC chains

Data

Data should passed through a named list with the following:

  • Nages Integer, number of age classes in the model

  • Ldyr Integer, number of years in the model

  • lht Integer, life history type. Should be 1 for now

  • hatchsurv Numeric, survival of hatchery releases into the smolt life stage. Density-independent.

  • gamma Optional. Numeric, the relative spawning success of hatchery origin spawners. Default is 1.

  • ssum Numeric, proportion of spawners that is female

  • finitPT Numeric, initial preterminal fishing mortality for calculating the equilibrium spawners at age in the first year of the model. Default is 0.

  • finitT Numeric, initial terminal fishing mortality for calculating the equilibrium spawners at age in the first year of the model. Default is 0.

  • bmatt Vector length Nages. Proportion maturity at age, base values for calculating the unfished replacement line.

  • fec Vector length Nages. Fecundity, egg production at age

  • vulPT Vector length Nages. Vulnerability at age to the preterminal fishery

  • vulT Vector length Nages. Vulnerability at age to the terminal fishery

  • mobase. Vector length Nages. Natural mortality at age, base values for calculating the unfished replacement line and the the equilibrium spawners at age.

  • cwtrelease Vector length Ldyr, coded wire tag (CWT) releases

  • cwtesc Matrix [Ldyr, Nages]. CWT escapement by brood year and age. Poisson likelhood.

  • cwtcatPT Matrix [Ldyr, Nages]. CWT preterminal catch, by brood year and age. Poisson likelhood. Set all values to zero to turn off parameters related to the preterminal fishery.

  • cwtcatT Matrix [Ldyr, Nages]. CWT terminal catch, by brood year and age. Poisson likelhood. Set all values to zero to turn off parameters related to the terminal fishery.

  • RelRegFPT Vector Ldyr. Trend in relative regional preterminal fishing mortality. Fishing mortality is estimated by estimating a scaling coefficient and annual deviations from this vector.

  • RelRegFT Vector Ldyr. Trend in relative regional terminal fishing mortality.

  • obsescape Vector length Ldyr, total observed escapement (all ages and both hatchery/natural fish). Lognormal likelhood.

  • propwildspawn Vector length Ldyr, proportion of the escapement that spawn (accounts for en-route mortality and broodtake)

  • hatchrelease Vector length Ldyr+1, number of hatchery juvenile fish released

  • cwtExp Numeric, the CWT sampling rate. This coefficient scales down the CWT predictions to match the observations. For example, cwtExp = 0.1 reduces the CWT predictions by 0.1 for the likelihood. Default is 1.

  • covariate1 Optional. Matrix Ldyr, ncov1 of linear covariates that predict natural mortality for age 1.

  • covariate Optional. Matrix Ldyr, ncov of linear covariates that predict natural mortality for ages 2+.

  • s_enroute Numeric, survival of escapement to spawning grounds. Default is 1.

  • so_mu Numeric, the prior mean for unfished spawners in logspace. Default is log(3 * max(data$obsescape)).

  • so_sd Numeric, the prior standard deviation for unfished spawners in logspace. Default is 0.5.

  • fitness Logical, whether to calculate fitness effects on survival. Default is FALSE.

  • theta Vector length 2, the optimum phenotype value for the natural and hatchery environments. Default is 100 and 80, respectively. See online article for more information.

  • rel_loss Vector length 3, the loss in fitness apportioned between the egg, fry (both prior to density-dependence), and smolt (after density-dependence) life stage. The three values should sum to 1.

  • zbar_start Vector length 2, the mean phenotype of the spawners and broodtake in the natural and hatchery environment, respectively, at the start of the model. Default values of 100 and 100, implying maximum fitness at for the natural environment at the start of the model.

  • fitness_variance Numeric. The variance of the phenotypic trait. Assumed identical between the natural and hatchery environments. Default is 10.

  • selection_strength Numeric. The ratio between the fitness standard deviation and the phenotype standard deviation. Default is 3.

  • heritability Numeric. The heritability of the phenotypic trait. Between 0-1. Default is 0.5.

  • fitness_floor Numeric. The minimum fitness value in the natural and hatchery environments. Default is 0.5.

start

Starting values for parameters can be provided through a named list:

  • log_cr Numeric, log of the compensation ratio (productivity). Default is 3.

  • log_so Numeric, unfished spawners in logspace. Default is log(3 * max(data$obsescape)).

  • moadd Numeric, additive term to base natural mortality rate for age 1 juveniles. Default is zero.

  • wt Vector Ldyr. Annual deviates in natural mortality during the freshwater life stage (affects survival to smolt life stage). Estimated with normal prior with mean zero and standard deviation p$wt_sd. Default is zero.

  • wto Vector Ldyr. Annual deviates in natural mortality for age 2+ juveniles (marine life stage). Estimated with normal prior with mean zero and standard deviation p$wto_sd. Default is zero.

  • FbasePT Numeric, scaling coefficient to estimate preterminal fishing mortality from data$RelRegFPT. Default is 1.

  • FbaseT Numeric, scaling coefficient to estimate preterminal fishing mortality from data$RelRegFT. Default is 1.

  • fanomalyPT Vector Ldyr. Annual deviates from FbasePT * data$RelRegFPT to estimate preterminal fishing mortality. Estimated with normal prior with mean zero and standard deviation p$fanomaly_sd. Default is zero.

  • fanomalyT Vector Ldyr. Annual deviates from FbaseT * data$RelRegFT to estimate terminal fishing mortality. Estimated with normal prior with mean zero and standard deviation p$fanomalyPT_sd. Default is zero.

  • lnE_sd Numeric, lognormal standard deviation of the observed escapement. Estimated with hierarchical gamma(2, 5) prior. Default is 0.1.

  • wt_sd Numeric, lognormal standard deviation of the age 1 (freshwater) natural mortality deviates. Estimated with hierarchical gamma(2, 5) prior. Default is 1.

  • wto_sd Numeric, lognormal standard deviation of the age 2+ (marine) natural mortality deviates. Estimated with hierarchical gamma(2, 5) prior. Default is 1.

  • fanomalyPT_sd Numeric, lognormal standard deviation of fanomalyPT. Estimated with hierarchical gamma(2, 5) prior. Default is 1.

  • fanomalyT_sd Numeric, lognormal standard deviation of fanomalyT. Estimated with hierarchical gamma(2, 5) prior. Default is 1.

  • logit_matt Matrix Ldyr, Nages-2 maturity by year and age in logit space. Maturity is fixed to zero and one at age 1 and the maximum age, respectively. Default is 0.1.

  • sd_matt Vector Nages-2. Logit standard deviation of maturity (logit_matt) by age class. Default is 0.5.

  • b1 Vector ncov1 of coefficients for linear covariates that predict natural mortality for age 1. Default is zero.

  • b Vector ncov of coefficients for linear covariates that predict natural mortality for ages 2+. Default is zero.

Bounds

By default, the standard deviation parameters and parameters in normal space (e.g., FbasePT, Fbase_T) have a lower bound of zero. moadd has a lower bound of zero by default, but it is feasible that this parameter can be negative as well. Deviation parameters centred around zero are bounded between -3 to 3. The log_cr parameter has a lower bound of zero.

All other parameters are unbounded.

Covariates on natural mortality

Natural mortality is modeled as the sum of a base value \(M^\textrm{base}\), additional scaling factor for age 1 \(M^\textrm{add}\), a linear system of covariates \(X\) and coefficients \(b\):

$$ M_{y,a} = \begin{cases} M^\textrm{base}_a + M^\textrm{add} + \sum_j b^1_j X^1_{y,j} & \quad a = 1\\ M^\textrm{base}_a + \sum_j b_j X_{y,j} & \quad a = 2, \ldots, A \end{cases} $$

References

Korman, J. and Walters, C. 2024. A life cycle model for Chinook salmon population dynamics. Canadian Contractor Report of Hydrography and Ocean Sciences 62: vi + 60 p.

See also

Author

Q. Huynh with Stan code provided by J. Korman and C. Walters