Skip to main content

Module distribution

Module distribution 

Source
Expand description

Probability distributions. Each has a density, a cumulative distribution, a quantile function and a sampler. The first three are also function objects, Pdf, Cdf and Quantile, which hold the distribution. Their slice forms choose the distribution’s formulas once, outside the loop, so the loops of the closed-form distributions vectorize. Their one-item forms run the slice forms on one item. An item of a slice form fails where its result is NaN and its argument isn’t, as for a quantile of p outside 0 to 1. A discrete distribution’s density is its mass at a whole x, and its quantile function and sampler give whole numbers.

Modules§

standard
The standard parameters of the distributions that have them, in the order their constructors take them.

Structs§

Cdf
Distribution::cdf as a function object. The normal and log-normal distributions’ slice forms take erfc from Erfc’s slice form, which computes only the formulas that each block of arguments needs. The Cauchy distribution’s takes atan from Atan’s, and the Weibull distribution uses the shared [Pow] formula.
Distribution
A probability distribution, whose constructor checked its parameters.
Invalid
A parameter outside its distribution’s domain, with a message that says which.
Pdf
Distribution::pdf as a function object. The log-normal distribution’s slice form takes ln from Ln’s slice form, which vectorizes where a loop of whole densities doesn’t. The Weibull distribution uses the shared [Pow] formula.
Quantile
Distribution::quantile as a function object, through [quantiles]. The normal and log-normal distributions’ slice forms take erfcinv(2p) from Erfcinv’s slice form, whose loops don’t branch on each item’s region. Logarithms use Log1p and Ln slice forms; tangent and root use the shared [Tan] and [Root] formulas.