Map initial age-structure deviation parameters
do_InitDevs_mapping.RdInternal helper called by Setup_Mod_Rec to construct
the TMB/RTMB factor map for ln_InitDevs, the log-scale deviations
from the equilibrium initial age structure. The ln_InitDevs array has
dimensions [n_pop x n_regions x (n_ages - 1)], where the age
dimension excludes the plus group by default (see equil_init_age_strc
below).
Arguments
- input_list
Named list with
$data,$par, and$mapsublists. Requires$data$equil_init_age_strc,$data$rec_region_prop_spec,$data$natal_region, and$data$rec_ddto be set by upstream setup functions.- InitDevs_spec
Character string specifying the sharing structure for
ln_InitDevs, orNULLto estimate all deviations independently across all dimensions. Options when non-NULL:"est_shared_pop_r"A single set of age-specific deviations shared across all populations and regions. Each age class receives one estimated parameter regardless of how many populations or regions are modelled. Required when
rec_dd = "global"andn_regions > 1."est_shared_r"Separate age-specific deviations per population, shared across regions within each population. Regions within the same population are constrained to identical initial age structure. Also valid under global density dependence.
"fix"All
ln_InitDevsparameters fixed at zero (mapped toNA). Equivalent to assuming a fully deterministic initial age structure.NULLEstimate all deviations independently across populations, regions, and ages. Not permitted when
rec_region_prop_spec = 1andn_pop > 1, as non-natal regions have no recruitment.
- rec_dd
Recruitment density-dependence structure inherited from
Setup_Mod_Rec."global"restricts validInitDevs_specchoices to"est_shared_r"or"est_shared_pop_r"whenn_regions > 1.Integer vector of length
n_ages - 1specifying an explicit parameter-sharing structure forln_InitDevsalong the age dimension. Each element gives the factor level assigned to that age position; positions sharing the same integer value are constrained to a single estimated parameter. Used in conjunction withequil_init_age_strc = 3("stoch_shared_ages"), which activates user-defined age sharing while still estimating deviations independently across populations and regions. The sharing structure is also respected byInitDevs_specoptions:"est_shared_r"applies the vector per population (with a population-level offset so pops remain independent), and"est_shared_pop_r"applies it globally (no offset, all pops and regions share the same parameters). A typical use case is replicating ADMB models where ages beyond the data plus group share the last estimated deviation, e.g.c(1:42, rep(42, 9))for a 52-age model with 43 data ages, giving 42 free parameters. WhenNULL(default), age sharing follows the standard behaviour determined byequil_init_age_strcalone.
Value
The input input_list with $map$ln_InitDevs set to a
factor vector of length prod(dim(par$ln_InitDevs)). Active
parameters receive sequential integer indices; plus-group slots (when
equil_init_age_strc = 1) and non-natal region slots (when
rec_region_prop_spec = 1) are NA. Starting values in
$par$ln_InitDevs are also reset to 0 for any fixed cells.
Details
Mapping behaviour is governed by three interacting considerations:
Equilibrium initialisation (
equil_init_age_strc): if0, all deviations are fixed at zero (no stochastic initial structure). If1, plus-group deviations are fixed and the remaining ages are estimated or shared. If2, all ages including the plus group receive stochastic deviations.Sharing specification (
InitDevs_spec): controls whether deviations are shared across regions and/or populations.No-dispersal constraint: when
rec_region_prop_spec = 1andn_pop > 1, non-natal regions receive no recruitment and their initial age deviations are structurally zero; these are automatically fixed toNAregardless ofInitDevs_spec, and the remaining indices are re-numbered sequentially.