Compute a model-agnostic selectivity smoothness / dome-shape penalty (Positive Scale)
Get_Selex_Smoothness_Penalty.RdRegularization 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_likedome penalty (lambda(3)) for double-logistic / spline selectivity forms.0(default) disables this term. Usesmax(., 0)(an RTMB/CppAD-safe smooth hinge; directif()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 to10000.- normalize
Logical. If
TRUE(default),wt_bin_curveis divided by the number of bins andwt_yr_diff/wt_yr_curveare divided by the number of years. Set toFALSEto reproduce the older, unnormalized bin/year curvature penalty used byGet_sel_PE_loglikfor the semi-parametric process-error models (TimeVary_Model3–5) –Get_sel_PE_loglikalways calls this withnormalize = FALSE.