Skip to contents

Projects each non-direct-removal selectivity series either by repeating its recent mean or by drawing independent lognormal values by age.

Usage

project_selectivity(
  data,
  obj,
  mcmc = NULL,
  first_yr = 2021L,
  last_yr = 2035L,
  samp_years = NULL,
  iters = NULL,
  option = c("mean_last", "lognormal"),
  n_years = 10L,
  retain_fitted_through = first_yr - 1L
)

Arguments

data

A list containing model data including dimensions and biological parameters.

obj

A TMB model object returned from MakeADFun.

mcmc

Optional MCMC fit object from SparseNUTS. If NULL, uses MLE parameters.

first_yr

An integer specifying the first projection year (default: 2021).

last_yr

An integer specifying the last projection year (default: 2035).

samp_years

An integer vector of historical years to use when projecting selectivity. If NULL, uses the n_years years immediately before first_yr.

iters

An integer vector specifying which MCMC iterations to use. If NULL, all posterior draws are used when mcmc is supplied and one MLE iteration is used otherwise.

option

A character string specifying the projection method. "mean_last" repeats the mean selectivity over samp_years; "lognormal" draws future selectivity from the historical log-scale mean and standard deviation.

n_years

An integer specifying the number of historical years to use when samp_years = NULL.

retain_fitted_through

Final historical assessment year whose fitted selectivity is retained in the output. It must be between first_yr - 1 and data$last_yr. The default, first_yr - 1, projects selectivity for every output year.

Value

An array of projected selectivity with dimensions draw by series by projection year by age.

Details

The output row order follows iters. The lognormal option calls rnorm() and changes the caller's random-number state; set the seed before calling when reproducibility is required. Output years through retain_fitted_through are copied from the corresponding fitted posterior selectivity before the projection method is applied to later years. Direct-removal series remain missing because selectivity is not used for those removals.