On this page

Calculate length at age, weight, maturity, survey catchability, fishery selectivity and the length transition matrices of a simulation from the parameters of initialize_params().

Usage

sim_cal(params)

Arguments

ArgumentDefaultDescription
paramsrequired

A list of parameters from initialize_params(); its model_type ("age_based" or "length_based") sets the orientation of pla and whether Gij is built.

Value

A list of biological arrays. model_type identifies the structure of the operating model; LatA is mean length at age; W_at_len is individual weight at length; mat is maturity; q_surv is survey catchability; sel is fishery selectivity; pla is the matrix of length probabilities conditional on age. nlen, len_mid, len_lower and len_upper describe the length bins. Gij is the growth transition matrix between length bins over one time step for length_based models and NULL for age_based models. biology_inputs records the biological parameters used to calculate the arrays.

Details

pla gives length-bin probabilities conditional on age. In the age_based simulator its rows are ages and columns are length bins (each row sums to one); in the length_based simulator its rows are length bins and columns are ages (each column sums to one). Gij[i, j] is the probability of moving from length bin j to length bin i over one model time step; each column sums to one. params$structure can set growth_increment and growth_transition, with the values of the structure argument of run_alscl(); they determine how Gij is calculated.

sim_data() checks biology_inputs and the arrays against sim_cal(params) before drawing random numbers or writing files. Run sim_cal(params) again after changing growth, ages, the time step, the length bins, weight, maturity, catchability or fishery selectivity; change the parameters, not the arrays. Changing only mortality, recruitment, errors, the simulation duration or the calendar needs no new sim_cal().

Length bins in the tails of the length-at-age distribution can have very small positive probabilities. The simulator carries those probabilities into the survey observations. For custom dome-shaped fishery selectivity, set pa$sel_type to "dome" and give the ascending limb (sel_L50_asc < sel_L95_asc) and the descending limb (sel_L50_desc > sel_L95_desc). In an age-based simulation, selectivity at each age is the length-specific curve averaged over the distribution of length at that age. The length-based simulation uses the curve directly.

Examples

Run the setup before the example. Fitting examples require an R-compatible C++ toolchain; simulation and export examples may write files.

Example setup
library(ALSCL)
library(ggplot2)
library(patchwork)
data("YTF_example")
x <- YTF_example
inputs <- x[c("data.CatL", "data.wgt", "data.mat")]
dat <- x$data.CatL
pa <- initialize_params(species = "flatfish")
bio <- sim_cal(pa)
# Use objects defined above
bio <- sim_cal(pa)

See also

Search documentation