Set the bounds that constrain a distribution when it is discretised: max
truncates the support at that value, while cdf_cutoff trims the tail by
keeping the distribution only up to its cdf_cutoff 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_cutoff
Numeric in
(0, 1]; the cumulative probability up to which the distribution is kept, i.e. it is truncated at thecdf_cutoffquantile. For examplecdf_cutoff = 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).
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_cutoff = 0.999)
#> - gamma distribution (cdf_cutoff: 0.999):
#> shape:
#> 25
#> rate:
#> 5