Define M1 specifications
Usage
build_M1(
M1_model = 0,
M1_re = 0,
updateM1 = FALSE,
M1_use_prior = FALSE,
M2_use_prior = FALSE,
M_prior = 0.4,
M_prior_sd = 0.35,
M1_indices = NA,
linkages = NULL
)Arguments
- M1_model
Vector or scalar specifying the M1 structural fixed- effects model. Either an integer code or the equivalent string alias (both forms are accepted; the integer code is canonical):
0/"fixed"– use the inputM1_base(no estimation).1/"sex_age_invariant"– estimate oneM1_{spp}.2/"sex_specific"– estimateM1_{spp, sex}.3/"sex_age_specific"– estimateM1_{spp, sex, age}.4,5– soft-deprecated env-driven codes; use thelinkagesargument instead. Seevignette("environmental-linkages-and-priors").
- M1_re
Vector or scalar specifying the M1 random-effects model. Either an integer code or the equivalent string alias:
0/"none",1/"iid_age",2/"iid_year",3/"iid_age_year",4/"ar1_age",5/"ar1_year",6/"ar1_age_year".- updateM1
If using initial parameters, use M1 fixed effects from data (
M1_base) instead. DefaultFALSE.- M1_use_prior
Vector or scalar; if
TRUE, apply the lognormalM_prior/M_prior_sdtoM1directly.- M2_use_prior
Vector or scalar; if
TRUE, apply the lognormal prior toM1 + M2in multi-species models.- M_prior
Mean (natural-scale) of the lognormal prior on M.
- M_prior_sd
SD (log-scale) of the lognormal prior on M.
- M1_indices
Soft-deprecated. Vector of column indices into
env_data(excludingYear) for environmentally linked M1 whenM1_model %in% c(4, 5). Use thelinkagesargument instead; seevignette("environmental-linkages-and-priors").- linkages
Optional named list of
linkage_spec()objects keyed by M parameter name (currently the only valid key is"M1"). Each spec describes howM1depends on environmental covariates and on stratifying factors (species, sex, age). The offset enters additively (on the log scale) inside theM1_at_agecompute. A row'sage_bin == NAbroadcasts the offset across ages; specific values pin it to that age slice.
Examples
if (FALSE) { # \dontrun{
# Sex/age-invariant M with a temperature linkage on M1
build_M1(
M1_model = "sex_age_invariant",
linkages = list(
M1 = linkage_spec(
formula = ~ temp,
by = ~ species,
priors = list(temp = normal(0, 0.5))
)
)
)
} # }