Inverse Gamma distribution


Story

If \(Y\) is Gamma distributed, then \(1/Y\) is Inverse Gamma distributed.


Parameters

The number of arrivals, \(\alpha\), and the rate of arrivals, \(\beta\).


Support

The Inverse Gamma distribution is supported on the set of positive real numbers.


Probability density function

\[\begin{align} f(y;\alpha, \beta) = \frac{1}{\Gamma(\alpha)}\,\frac{\beta^\alpha}{y^{\alpha+1}} \,\mathrm{e}^{-\beta / y}, \end{align}\]

where \(\Gamma(\alpha)\) is the gamma function.


Cumulative distribution function

\[\begin{align} F(y;\alpha, \beta) = Q(\alpha, \beta/x), \end{align}\]

a regularized upper incomplete gamma function.


Moments

Mean: \(\displaystyle{\frac{\beta}{\alpha - 1}}\) for \(\alpha > 1\); for \(\alpha \le 1\), the mean is undefined.

Variance: \(\displaystyle{\frac{\beta^2}{(\alpha-1)^2(\alpha-2)}}\) for \(\alpha > 2\); for \(\alpha \le 2\), the variance is undefined.


Usage

Package

Syntax

NumPy

1 / rng.gamma(alpha, 1/beta)

SciPy

scipy.stats.invgamma(alpha, loc=0, scale=beta)

Distributions.jl

InverseGamma(alpha, beta)

Stan

inv_gamma(alpha, beta)



Notes

  • The Inverse Gamma distribution is useful as a prior for positive parameters. It imparts a quite heavy tail and keeps probability further from zero than the Gamma distribution.

  • NumPy module does not have a function to sample directly from the Inverse Gamma distribution, but it can be achieved by sampling out of a Gamma distribution and then taking the inverser, as shown in the NumPy usage above.


PDF and CDF plots