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.


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 number of arrivals, \(\alpha\), and the rate of arrivals, \(\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}\]

Moments

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

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


Usage

Package

Syntax

NumPy

rg.gamma(alpha, 1/beta)

SciPy

scipy.stats.gamma(alpha, loc=0, scale=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