Hypergeometric distribution

mpsci.distributions.hypergeometric.cdf(k, ntotal, ngood, nsample)

Cumulative distribution function of the hypergeometric distribution.

mpsci.distributions.hypergeometric.logpmf(k, ntotal, ngood, nsample)

Logarithm of the PMF of the hypergeometric distribution.

logpmf computes the natural logarithm of the probability mass function of the hypergeometric distribution.

mpsci.distributions.hypergeometric.mean(ntotal, ngood, nsample)

Mean of the hypergeometric distribution.

mpsci.distributions.hypergeometric.pmf(k, ntotal, ngood, nsample)

Probability mass function of the hypergeometric distribution.

mpsci.distributions.hypergeometric.sf(k, ntotal, ngood, nsample)

Survival function of the hypergeometric distribution.

mpsci.distributions.hypergeometric.support_pmf(ntotal, ngood, nsample)

Support and PMF of the hypergeometric distribution.

Returns:

  • sup (range) – The range of integers in the support. (In Python 3, use list(sup) to get the list of integers in the support.)

  • p (sequence of mpmath floats) – The probability of each integer in the support.

Examples

>>> sup, pvals = hypergeometric.support_pmf(20, 14, 5)
>>> for k, p in zip(sup, pvals):
...     print("{:2} {:10.7f}".format(k, float(p)))
...
 0  0.0003870
 1  0.0135449
 2  0.1173891
 3  0.3521672
 4  0.3873839
 5  0.1291280
mpsci.distributions.hypergeometric.var(ntotal, ngood, nsample)

Variance of the hypergeometric distribution.