Binomial distribution

mpsci.distributions.binomial.cdf(k, n, p, method='incbeta')

Cumulative distribution function of the binomial distribution.

method must be either “sumpmf” or “incbeta”. When method is “sumpmf”, the CDF is computed with a simple sum of the PMF values. When method is “incbeta”, the incomplete beta function is used. This method is generally faster than the “sumpmf” method, but for large values of k or n, the incomplete beta function of mpmath might fail.

mpsci.distributions.binomial.logpmf(k, n, p)

Natural log of the probability mass function of the binomial distribution.

mpsci.distributions.binomial.mean(n, p)

Mean of the binomial distribution.

mpsci.distributions.binomial.pmf(k, n, p)

Probability mass function of the binomial distribution.

mpsci.distributions.binomial.sf(k, n, p, method='incbeta')

Survival function of the binomial distribution.

method must be either “sumpmf” or “incbeta”. When method is “sumpmf”, the survival function is computed with a simple sum of the PMF values. When method is “incbeta”, the incomplete beta function is used. This method is generally faster than the “sumpmf” method, but for large values of k or n, the incomplete beta function of mpmath might fail.

mpsci.distributions.binomial.support(n, p)

Support of the binomial distribution.

The support is the integers 0, 1, 2, …, n; this is implemented by returning range(n + 1). That is, the return value is the range instance, not a sequence.

Examples

>>> from mpsci.distributions import binomial
>>> sup = binomial.support(5, 0.25)
>>> [k for k in sup]
[0, 1, 2, 3, 4, 5]
mpsci.distributions.binomial.var(n, p)

Variance of the binomial distribution.