Bounds a probability vector to \([\epsilon,\, 1 - \epsilon]\) so that downstream \(\log p\) or \(\log(1 - p)\) evaluations stay finite. Used throughout the likelihood and prediction code to guard survival and CDF values against exact 0 or 1.
See also
hzr_log1pexp() and hzr_log1mexp() for the companion
stable-logarithm primitives.
Examples
hzr_clamp_prob(c(0, 0.5, 1))
#> [1] 1e-12 5e-01 1e+00