Skip to contents

Regularization penalty operating directly on a realized selectivity-at-bin-at-year surface, rather than on any particular parameterization's deviations. Because it only ever looks at the resulting selectivity values, it applies uniformly to any selectivity functional form – semi-parametric process-error models (TimeVary_Model 3–5, via Get_sel_PE_loglik) and the bicubic / cubic spline (Selex_Model == 8, via Get_Selex) alike. This is the "modular" building block behind SPoRC's independently-weighted selectivity penalty terms: each term below is switched off by setting its weight to 0, and terms can be combined freely without one implicit shared on/off flag.

Usage

Get_Selex_Smoothness_Penalty(
  sel_vals,
  wt_bin_curve = 0,
  wt_bin_diff = 0,
  wt_yr_diff = 0,
  wt_yr_curve = 0,
  wt_dome = 0,
  wt_mean_center = 0,
  normalize = TRUE
)

Arguments

sel_vals

Array of selectivity values dimensioned [1, year, bin, sex, 1]. Evaluated on the log scale internally.

wt_bin_curve

Non-negative weight on the age/bin curvature penalty: the sum of squared second differences of log-selectivity across bins, within each year, normalized by the number of bins. Penalizes jagged (non-smooth) selectivity-at-age curves. 0 (default) disables this term. Requires at least 3 bins to have any effect.

wt_bin_diff

Non-negative weight on the unconditional bin first-difference penalty: the sum of squared first differences of log-selectivity across bins, within each year, normalized by the number of bins. Unlike wt_dome (which only penalizes decreases), both increases and decreases contribute. Requires at least 2 bins to have any effect.

wt_yr_diff

Non-negative weight on the inter-annual first-difference penalty: the sum of squared first differences of log-selectivity across years, within each bin, normalized by the number of years. Penalizes abrupt year-to-year jumps in selectivity-at-bin. 0 (default) disables this term. Requires at least 2 years to have any effect.

wt_yr_curve

Non-negative weight on the inter-annual second-difference (smoothness) penalty: the sum of squared second differences of log-selectivity across years, within each bin, normalized by the number of years. Penalizes jagged (non-smooth) year-to-year selectivity trajectories. 0 (default) disables this term. Requires at least 3 years to have any effect.

wt_dome

Non-negative weight on the dome-shape (non-monotonicity) penalty: for each year, penalizes any decrease in log-selectivity moving from one bin to the next (i.e. discourages, but does not forbid, dome shapes), matching ADMB's sel_like dome penalty (lambda(3)) for double-logistic / spline selectivity forms. 0 (default) disables this term. Uses max(., 0) (an RTMB/CppAD-safe smooth hinge; direct if() branching on AD types is unsupported) so only decreases, not increases, are penalized.

wt_mean_center

Non-negative weight on a per-year mean-centering (sum-to-zero) regularization: for each year, penalizes the squared mean of log-selectivity across bins. 0 (default) disables this term; set to 10000.

normalize

Logical. If TRUE (default), wt_bin_curve is divided by the number of bins and wt_yr_diff/wt_yr_curve are divided by the number of years. Set to FALSE to reproduce the older, unnormalized bin/year curvature penalty used by Get_sel_PE_loglik for the semi-parametric process-error models (TimeVary_Model 3–5) – Get_sel_PE_loglik always calls this with normalize = FALSE.

Value

Numeric scalar: the positive log-likelihood contribution from the requested penalty terms. Negated externally to form the negative log-likelihood.