Gamma probability distribution

The parameters used here are k, the shape parameter, and theta, the scale parameter.

Another common parameterization is shape k and the “rate” lambda. theta is the reciprocal of lambda.

mpsci.distributions.gamma.cdf(x, k, theta)

Gamma distribution cumulative distribution function.

k is the shape parameter theta is the scale parameter (reciprocal of the rate parameter)

Unlike scipy, a location parameter is not included.

mpsci.distributions.gamma.entropy(k, theta)

Differential entropy of the gamma distribution.

mpsci.distributions.gamma.interval_prob(x1, x2, k, theta)

Compute the probability of x in [x1, x2] for the gamma distribution.

Mathematically, this is the same as

gamma.cdf(x2, k, theta) - gamma.cdf(x1, k, theta)

but when the two CDF values are nearly equal, this function will give a more accurate result.

x1 must be less than or equal to x2.

mpsci.distributions.gamma.invcdf(p, k, theta)

Inverse of the CDF of the gamma distribution.

mpsci.distributions.gamma.invsf(p, k, theta)

Inverse of the survival function of the gamma distribution.

mpsci.distributions.gamma.kurtosis(k, theta)

Excess kurtosis of the gamma distribution.

mpsci.distributions.gamma.logpdf(x, k, theta)

Log of the PDF of the gamma distribution.

mpsci.distributions.gamma.mean(k, theta)

Mean of the gamma distribution.

mpsci.distributions.gamma.mle(x, *, k=None, theta=None)

Gamma distribution maximum likelihood parameter estimation.

Maximum likelihood estimate for the k (shape) and theta (scale) parameters of the gamma distribution.

x must be a sequence of values.

mpsci.distributions.gamma.mom(x)

Parameter estimation by the method of moments for the gamma distribution.

x must be a sequence of values.

Returns the estimates of the shape k and the scale theta.

mpsci.distributions.gamma.nll(x, k, theta)

Gamma distribution negative log-likelihood.

mpsci.distributions.gamma.nll_grad(x, k, theta)

Gamma distribution gradient of the negative log-likelihood function.

mpsci.distributions.gamma.nll_hess(x, k, theta)

Gamma distribution hessian of the negative log-likelihood function.

mpsci.distributions.gamma.nll_invhess(x, k, theta)

Gamma distribution inverse of the hessian of the negative log-likelihood.

mpsci.distributions.gamma.noncentral_moment(n, k, theta)

n-th noncentral moment of the gamma distribution.

n must be a nonnegative integer.

mpsci.distributions.gamma.pdf(x, k, theta)

Gamma distribution probability density function.

k is the shape parameter theta is the scale parameter (reciprocal of the rate parameter)

Unlike scipy, a location parameter is not included.

mpsci.distributions.gamma.sf(x, k, theta)

Survival function of the gamma distribution.

mpsci.distributions.gamma.skewness(k, theta)

Skewness of the gamma distribution.

mpsci.distributions.gamma.support(k, theta)

Support of the gamma distribution.

mpsci.distributions.gamma.var(k, theta)

Variance of the gamma distribution.