The module randist offers a set of functions that mirrors those available from the module rnd. Generally, for each kind of distribution, a few functions are available to calculate the probability density function, the cumulative distribution function and the inverse cumulative distribution function.
The cumulative distribution functions and their inverses are computed separately for the upper and lower tails of the distribution, allowing full accuracy to be retained for small results.
Continuous random number distributions are defined by a probability density function, \(p(x)\), such that the probability of \(x\) occurring in the infinitesimal range \(x\) to \(x+dx\) is \(p(x) dx\).
The cumulative distribution function for the lower tail \(P(x)\) is defined by the integral,
and gives the probability of a variate taking a value less than \(x\).
The cumulative distribution function for the upper tail \(Q(x)\) is defined by the integral,
and gives the probability of a variate taking a value greater than \(x\).
The upper and lower cumulative distribution functions are related by \(P(x) + Q(x) = 1\) and satisfy \(0 \le P(x) \le 1\), \(0 \le Q(x) \le 1\).
The inverse cumulative distribution functions, \(x = P^{-1}(p)\) and \(x = Q^{-1}(q)\) give the values of \(x\) which correspond to a specific value of \(p\) or \(q\). They can be used to find confidence limits from probability values.
For discrete distributions, the probability of sampling the integer value \(k\) is given by \(p(k)\), where \(\sum_k p(k) = 1\). The cumulative distribution function for the lower tail \(P(k)\) of a discrete distribution is defined as,
where the sum is over the allowed range of the distribution less than or equal to \(k\).
The cumulative distribution function for the upper tail of a discrete distribution \(Q(k)\) is defined as
giving the sum of probabilities for all values greater than \(k\). These two definitions satisfy the identity \(P(k) + Q(k) = 1\).
If the range of the distribution is 1 to \(n\) inclusive, then \(P(n)=1\), \(Q(n)=0\) while \(P(1) = p(1)\), \(Q(1)=1-p(1)\).
The probability functions are named following an uniform naming convention. The probability density function end with the suffix _pdf. The cumulative distribution functions \(P(x)\) and \(Q(x)\) end with the suffix _P and _Q, respectively. The inverse cumulative distribution functions \(P^{-1}(x)\) and \(Q^{-1}(x)\) end with the suffix _Pinv and _Qinv, respectively.
We present here the list of the available probability functions.
Note
Actually LGSL implements all the functions provided by the GSL library but some of them are not listed here. Please consult the GSL reference manual if you need a complete list of all the distributions available.
See Laplace Distribution.
See t- Distribution.
See Cauchy Distribution.
See F- Distribution.
See Gamma Distribution.
See Beta Distribution.
See Poisson Distribution.