Generalized inverse Gaussian distribution

The parametrization used here is not the same as the parametrization used in the wikipedia article

A location parameters is not included in the parameters used in the wikipedia article.

Given the parmeters (a, b, p) used in the wikipedia article, the corresponding parameters used here are:

mpsci wikipedia p = p b = sqrt(a*b) loc = 0 scale = sqrt(b/a)

Going the other way, and assuming the location is zero, the formulas to convert from the parameters use here to those used in the wikipedia article are:

wikipedia mpsci a = b/scale b = scale*b p = p

mpsci.distributions.geninvgauss.cdf(x, p, b, loc=0, scale=1)

Cumulative distribution function of the generalized inverse Gaussian distribution.

The CDF is computed by using mpmath.quad to numerically integrate the PDF.

mpsci.distributions.geninvgauss.entropy(p, b, loc=0, scale=1)

Differential entropy of the generalized inverse Gaussian distribution.

mpsci.distributions.geninvgauss.logpdf(x, p, b, loc=0, scale=1)

Log of the PDF of the generalized inverse Gaussian distribution.

The PDF for \(x > \textsf{loc}\) is:

\[\frac{z^{(p - 1)}\exp\left(-\frac{b}{2}\left(z + \frac{1}{z}\right)\right)} {s K_{p}(b)}\]

where \(s\) is the scale, \(z = (x - \textsf{loc})/s\), and \(K_p(b)\) is the modified Bessel function of the second kind. For \(x \le \textsf{loc}\), the PDF is zero.

mpsci.distributions.geninvgauss.mean(p, b, loc=0, scale=1)

Mean of the generalized inverse Gaussian distribution.

The mean is:

\[\textsf{loc} + \textsf{scale} \frac{K_{p+1}(b)}{K_p(b)}\]

where \(K_n(x)\) is the modified Bessel function of the second kind (implemented in mpmath as besselk(n, x)).

mpsci.distributions.geninvgauss.mode(p, b, loc=0, scale=1)

Mode of the generalized inverse Gaussian distribution.

The mode is:

\[\textsf{loc} + \textsf{scale} \frac{p - 1 + \sqrt{(p - 1)^2 + b^2}}{b}\]
mpsci.distributions.geninvgauss.pdf(x, p, b, loc=0, scale=1)

Probability density function of the generalized inverse Gaussian distribution.

The PDF for \(x > \textsf{loc}\) is:

\[\frac{z^{(p - 1)}\exp\left(-\frac{b}{2}\left(z + \frac{1}{z}\right)\right)} {s K_{p}(b)}\]

where \(s\) is the scale, \(z = (x - \textsf{loc})/s\), and \(K_p(b)\) is the modified Bessel function of the second kind. For \(x \le \textsf{loc}\), the PDF is zero.

mpsci.distributions.geninvgauss.sf(x, p, b, loc=0, scale=1)

Survival function of the generalized inverse Gaussian distribution.

The survival function is computed by using mpmath.quad to numerically integrate the PDF.

mpsci.distributions.geninvgauss.support(p, b, loc=0, scale=1)

Support of the generalized inverse Gaussian distribution.

mpsci.distributions.geninvgauss.var(p, b, loc=0, scale=1)

Variance of the generalized inverse Gaussian distribution.