Gamma probability distribution¶
The parameters used here are k, the shape parameter, and scale, the scale parameter.
Another common parameterization is shape k and the “rate” lambda. lambda is the reciprocal of scale.
- mpsci.distributions.gamma.cdf(x, k, scale)¶
Gamma distribution cumulative distribution function.
k is the shape parameter scale is the scale parameter (reciprocal of the rate parameter)
Unlike scipy, a location parameter is not included.
- mpsci.distributions.gamma.entropy(k, scale)¶
Differential entropy of the gamma distribution.
- mpsci.distributions.gamma.interval_prob(x1, x2, k, scale)¶
Compute the probability of x in [x1, x2] for the gamma distribution.
Mathematically, this is the same as
gamma.cdf(x2, k, scale) - gamma.cdf(x1, k, scale)
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, scale)¶
Inverse of the CDF of the gamma distribution.
- mpsci.distributions.gamma.invsf(p, k, scale)¶
Inverse of the survival function of the gamma distribution.
- mpsci.distributions.gamma.kurtosis(k, scale)¶
Excess kurtosis of the gamma distribution.
- mpsci.distributions.gamma.logpdf(x, k, scale)¶
Log of the PDF of the gamma distribution.
- mpsci.distributions.gamma.mean(k, scale)¶
Mean of the gamma distribution.
- mpsci.distributions.gamma.mle(x, *, k=None, scale=None)¶
Gamma distribution maximum likelihood parameter estimation.
Maximum likelihood estimate for the k (shape) and 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.
- mpsci.distributions.gamma.nll(x, k, scale)¶
Gamma distribution negative log-likelihood.
- mpsci.distributions.gamma.nll_grad(x, k, scale)¶
Gamma distribution gradient of the negative log-likelihood function.
- mpsci.distributions.gamma.nll_hess(x, k, scale)¶
Gamma distribution hessian of the negative log-likelihood function.
- mpsci.distributions.gamma.nll_invhess(x, k, scale)¶
Gamma distribution inverse of the hessian of the negative log-likelihood.
- mpsci.distributions.gamma.noncentral_moment(n, k, scale)¶
n-th noncentral moment of the gamma distribution.
n must be a nonnegative integer.
- mpsci.distributions.gamma.pdf(x, k, scale)¶
Gamma distribution probability density function.
k is the shape parameter scale is the scale parameter (reciprocal of the rate parameter)
Unlike scipy, a location parameter is not included.
- mpsci.distributions.gamma.sf(x, k, scale)¶
Survival function of the gamma distribution.
- mpsci.distributions.gamma.skewness(k, scale)¶
Skewness of the gamma distribution.
- mpsci.distributions.gamma.support(k, scale)¶
Support of the gamma distribution.
- mpsci.distributions.gamma.var(k, scale)¶
Variance of the gamma distribution.