Gamma distribution


Story

The amount of time we have to wait for \(\alpha\) arrivals of a Poisson process. More concretely, if we have events, \(X_1, X_2, \ldots X_\alpha\) that are Exponentially distributed, \(X_1 + X_2 + \cdots X_\alpha\) is Gamma distributed. While this is the story for an integer number of arrivals, the Gamma distribution is defined for noninteger \(\alpha\) as well.


Example

Any multistep process where each step happens at the same rate. This is common in molecular rearrangements. For example, the time it takes for three phosphorylation events have to happen, assuming all phosphorylation events happen at the same rate, is Gamma distributed.


Parameters

The Gamma distribution has two parameter, both strictly positive. The shape parameter, corresponding to the number of arrivals of a Poisson process is \(\alpha\). The inverse scale parameter, corresponding to the rate of arrivals, is \(\beta\).


Support

The 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 y)^\alpha}{y} \,\mathrm{e}^{-\beta y}, \end{align}\]

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


Cumulative distribution function

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

a regularized lower incomplete gamma function.


Moments

Mean: \(\displaystyle{\frac{\alpha}{\beta}}\)

Variance: \(\displaystyle{\frac{\alpha}{\beta^2}}\)


Usage

Package

Syntax

NumPy

rng.gamma(alpha, 1/beta)

SciPy

scipy.stats.gamma(alpha, loc=0, scale=1/beta)

Distributions.jl

Gamma(alpha, 1/beta)

Stan

gamma(alpha, beta)



Notes

  • The Gamma distribution is useful as a prior for positive parameters. It imparts a heavier tail than the Half-Normal distribution (but not too heavy; it keeps parameters from growing too large), and allows the parameter value to come close to zero.

  • The SciPy implementation has a location parameter, which should be set to zero, with \(1/\beta\) being the scale parameter.


PDF and CDF plots