Set the bounds that constrain a distribution when it is discretised: max
truncates the support at that value, while cdf_max trims the tail by
keeping the distribution only up to its cdf_max quantile. Either bound
drops the mass beyond it and renormalises the remaining PMF to sum to one.
Arguments
- x
A
<dist_spec>.- max
Numeric, maximum value of the distribution. The distribution will be truncated at this value. Default:
Inf, i.e. no maximum.- cdf_max
Numeric in
(0, 1]; the cumulative probability up to which the distribution is kept, i.e. it is truncated at thecdf_maxquantile. For examplecdf_max = 0.999keeps the distribution up to its 99.9th percentile. Default:1, i.e. keep the full distribution. A value below0.5is rejected, as it is almost certainly the tail probability to drop rather than the CDF level to keep (use1 - xinstead).- cdf_cutoff
[Deprecated] Renamed to
cdf_max. Supplying it warns and the value is interpreted ascdf_max, i.e. the CDF level to keep (the distspec 0.1.0 convention). A value in the historical EpiNow2 convention (the tail probability to drop) is caught by the guard against values below0.5; passcdf_max = 1 - cdf_cutoffinstead.
See also
discretise(), which applies these bounds when producing a PMF.
Examples
# Truncate a gamma distribution at 20
bound_dist(Gamma(mean = 5, sd = 1), max = 20)
#> - gamma distribution (max: 19):
#> shape:
#> 25
#> rate:
#> 5
# Keep it up to its 99.9th percentile
bound_dist(Gamma(mean = 5, sd = 1), cdf_max = 0.999)
#> - gamma distribution (cdf_max: 0.999):
#> shape:
#> 25
#> rate:
#> 5