Capture a linkage specification
Usage
linkage_spec(
formula,
param = NULL,
data = NULL,
by = ~species,
species = NULL,
sex = NULL,
link = "identity",
init = NULL,
bounds = NULL,
priors = NULL,
re_group = NA_character_,
est_phase = 1L
)Arguments
- formula
one-sided R formula whose RHS describes the linear predictor for
param(e.g.~ 1,~ temp,~ temp + PDO).- param
target parameter name on the linear predictor scale (e.g.
"log_alpha","log_M1","log_K"). May beNULLwhen the spec is built inside abuild_*()call that infers the parameter name from the enclosing list key (seebuild_growth()).- data
(Optional) data frame for formula validation. Currently validation happens at materialization time inside
fit_mod().- by
one-sided formula naming stratifying factors that should each get their own coefficients. Allowed names are
species,sex, andage_bin. The default~speciesproduces one coefficient set per species (the typical multispecies assessment use case); pass~species + sexfor per-(species, sex) coefficients, orNULLto share a single coefficient set across every species/sex.- species
optional integer vector of 1-based species ids that this spec applies to.
NULL(default) means every species instrata$speciesat materialization time. Use this to give different species different formulas, e.g. by registering multiple specs against the same parameter – seebuild_growth()for the multi-spec syntax.- sex
optional vector of sex ids that this spec applies to. May be supplied as integers (
1L= female,2L= male) or as character strings ("Females"/"Males", case-insensitive;"female","male","f","m"are also accepted).NULL(default) means every sex instrata$sexat materialization time. Only meaningful whenbyincludessex; otherwise the filter is a no-op. Use this to register separate specs per sex (e.g. one prior on females, another on males) against the same parameter.- link
link function applied to the predictor when assembling process values; one of LINKAGE_LINKS. TODO
- init
optional named numeric vector of initial values keyed by the design-matrix column name (e.g.
c((Intercept)= -1, temp = 0)). Missing entries default to0.- bounds
optional named list of
c(lower, upper)keyed the same way asinit.- priors
optional named list whose entries are Rceattle_priors objects, keyed by design-matrix column name. Inside this argument the unprefixed shorthand
normal(),lognormal(),gamma(), andbeta()resolves to the correspondingprior_*constructors via a private data mask, sopriors = list(temp = normal(0, 1))works without maskingbase::gamma()orbase::beta()at the package level. Equivalent topriors = list(temp = prior_normal(0, 1)).- re_group
optional character: name of a random-effect grouping for these coefficients.
NA(default) means fixed.- est_phase
optional integer estimation phase. Default
1L.