One-dimensional Discrete Distribution Functions¶
Class providing discrete probability distribution functions of a single integer variable—the probability mass function \(p(x)\) (and its logarithm), the cumulative distribution function \(P(x) = \sum_{x' \le x} p(x')\), and the quantile function \(x(P)\). These distributions model count data such as the number of galaxies in a halo or the number of star formation events, and are used for drawing random variates and computing Poisson or binomial likelihoods in galaxy statistics and N-body halo occupation analyses.
Default implementation: distributionFunctionDiscrete1DBinomial
Methods¶
mass→double precisionReturn the probability mass function \(p(x)\), giving the probability that the discrete random variable takes the integer value
x.integer, intent(in ) :: x
massLogarithmic→double precisionReturn the natural logarithm of the probability mass function \(\ln p(x)\) evaluated at integer
x, which is more numerically stable for extremely small probabilities than computing \(p(x)\) directly.integer, intent(in ) :: x
cumulative→double precisionReturn the cumulative distribution function \(P(x) = \sum_{x' \le x} p(x')\), giving the probability that the discrete random variable takes a value less than or equal to integer
x.integer, intent(in ) :: xinteger, intent( out), optional :: status
cumulativeComplementary→double precisionReturn the complementary cumulative probability at
x.integer, intent(in ) :: xinteger, intent( out), optional :: status
inverse→integerReturn the value of the independent variable corresponding to cumulative probability
p.double precision, intent(in ) :: p
sample→integerReturn a random integer deviate drawn from this discrete probability distribution, using the inverse CDF method by default (drawing a uniform random number and applying the quantile function).
class(randomNumberGeneratorClass), intent(inout), optional :: randomNumberGenerator_
minimum→integerReturns the minimum possible integer value in the support of this discrete distribution, i.e., the smallest integer \(x\) for which the probability mass is non-zero.
maximum→integerReturns the maximum possible integer value in the support of this discrete distribution, i.e., the largest integer \(x\) for which the probability mass is non-zero.
distributionFunctionDiscrete1DBinomial¶
A 1D binomial discrete distribution function class, modeling the number of successes \(k\) in \(n\) independent Bernoulli trials each with success probability \(p\), with probability mass function \(P(k) = \binom{n}{k} p^k (1-p)^{n-k}\).
(Default implementation)
Parameters
[probabilitySuccess]— The probability \(p \in [0,1]\) of success on a single Bernoulli trial, which determines the mean (\(np\)) and variance (\(np(1-p)\)) of the resulting binomial distribution.[countTrials]— The total number of independent Bernoulli trials \(n\), which sets the range of the distribution from 0 to \(n\) and controls the overall scale of the mean and variance.
distributionFunctionDiscrete1DNegativeBinomial¶
A negative binomial 1D discrete distribution function class, modeling the number of successes \(k\) observed before a fixed number of failures \(r\) in a sequence of independent Bernoulli trials each with success probability \(p\), with probability mass function \(P(k) = \binom{k+r-1}{k} p^r (1-p)^k\). Note that the cumulative and inverse CDF methods are not currently implemented; only the probability mass function and its logarithm are available.
Parameters
[probabilitySuccess]— The probability \(p \in (0,1]\) of success on a single Bernoulli trial; the distribution models the number of successes before \(r\) failures occur, with mean \(pr/(1-p)\).[countFailures]— The target number of failures \(r\) before the experiment stops; the distribution gives the number of successes \(k\) observed before the \(r\)-th failure, with variance \(pr/(1-p)^2\).
distributionFunctionDiscrete1DPoisson¶
A Poisson 1D discrete distribution function class.
Parameters
[mean]— The mean of the distribution.