Skip to content
Surf Wiki
Save to docs
arts/film

From Surf Wiki (app.surf) — the open knowledge base

Gamma distribution

Probability distribution


Probability distribution

FieldValue
nameGamma
typedensity
pdf_image[[Image:Gammapdf252.svg325pxclass=skin-invert-imageProbability density plots of gamma distributions]]
cdf_image[[Image:Gammacdf252.svg325pxclass=skin-invert-imageCumulative distribution plots of gamma distributions]]
supportx \in 0, \infty)
pdff(x)=\frac{1}{\Gamma(\alpha) \theta^\alpha} x^{\alpha - 1} e^{-x/\theta}
cdfF(x)=\frac{1}{\Gamma(\alpha)} \gamma\left(\alpha, \frac{x}{\theta}\right)
mean\alpha \theta
medianSimple closed form does not exist
mode(\alpha - 1)\theta \text{ for } \alpha \geq 1, 0 \text{ for } \alpha
variance\alpha \theta^2
skewness\frac{2}{\sqrt{\alpha
  • α 0 [shape
  • θ 0 scale \alpha &+ \ln\theta + \ln\Gamma(\alpha)\ &+ (1 - \alpha)\psi(\alpha) \end{align} | α 0 shape | λ 0 rate \alpha &- \ln \lambda + \ln\Gamma(\alpha)\ &+ (1 - \alpha)\psi(\alpha) \end{align}

In probability theory and statistics, the gamma distribution is a versatile two-parameter family of continuous probability distributions. The exponential distribution, Erlang distribution, and chi-squared distribution are special cases of the gamma distribution. There are two equivalent parameterizations in common use:

  1. With a shape parameter α and a scale parameter θ
  2. With a shape parameter \alpha and a rate parameter In each of these forms, both parameters are positive real numbers.

The distribution has important applications in various fields, including econometrics, Bayesian statistics, and life testing. In econometrics, the (α, θ) parameterization is common for modeling waiting times, such as the time until death, where it often takes the form of an Erlang distribution for integer α values. Bayesian statisticians prefer the (α,λ) parameterization, utilizing the gamma distribution as a conjugate prior for several inverse scale parameters, facilitating analytical tractability in posterior distribution computations.

The gamma distribution is the maximum entropy probability distribution (both with respect to a uniform base measure and a 1/x base measure) for a random variable X for which is fixed and greater than zero, and is fixed (ψ is the digamma function).

Definitions

The parameterization with α and θ appears to be more common in econometrics and other applied fields, where the gamma distribution is frequently used to model waiting times. For instance, in life testing, the waiting time until death is a random variable that is frequently modeled with a gamma distribution. See Hogg and Craig for an explicit motivation.

The parameterization with α and λ is more common in Bayesian statistics, where the gamma distribution is used as a conjugate prior distribution for various types of inverse scale (rate) parameters, such as the λ of an exponential distribution or a Poisson distribution – or for that matter, the λ of the gamma distribution itself. The closely related inverse-gamma distribution is used as a conjugate prior for scale parameters, such as the variance of a normal distribution.

If α is a positive integer, then the distribution represents an Erlang distribution; i.e., the sum of α independent exponentially distributed random variables, each of which has a mean of θ.

Characterization using shape ''α'' and rate ''λ''

The gamma distribution can be parameterized in terms of a shape parameter and an inverse scale parameter , called a rate parameter. A random variable X that is gamma-distributed with shape α and rate λ is denoted

X \sim \Gamma(\alpha, \lambda) \equiv \operatorname{Gamma}(\alpha,\lambda)

The corresponding probability density function in the shape-rate parameterization is

\begin{align} f(x;\alpha,\lambda) & = \frac{ x^{\alpha-1} e^{-\lambda x} \lambda^\alpha}{\Gamma(\alpha)} \quad \text{ for } x 0 \quad \alpha, \lambda 0, \[6pt] \end{align}

where \Gamma(\alpha) is the gamma function. For all positive integers, \Gamma(\alpha)=(\alpha-1)!.

The cumulative distribution function is the regularized gamma function:

F(x;\alpha,\lambda) = \int_0^x f(u;\alpha,\lambda),du= \frac{\gamma(\alpha, \lambda x)}{\Gamma(\alpha)},

where \gamma(\alpha, \lambda x) is the lower incomplete gamma function.

If α is a positive integer (i.e., the distribution is an Erlang distribution), the cumulative distribution function has the following series expansion:

\begin{align} F(x;\alpha,\lambda) &= 1-\sum_{i=0}^{\alpha-1} \frac{\left(\lambda x\right)^i}{i!} e^{-\lambda x} \[1ex] &= e^{-\lambda x} \sum_{i=\alpha}^\infty \frac{\left(\lambda x\right)^i}{i!}. \end{align}

Characterization using shape ''α'' and scale ''θ''

A random variable X that is gamma-distributed with shape α and scale θ is denoted by

X \sim \Gamma(\alpha, \theta) \equiv \operatorname{Gamma}(\alpha, \theta)

The probability density function using the shape-scale parametrization is

f(x;\alpha,\theta) = \frac{x^{\alpha-1}e^{-x/\theta}}{\theta^\alpha\Gamma(\alpha)} \quad \text{ for } x 0 \text{ and } \alpha, \theta 0.

Here Γ(α) is the gamma function evaluated at α.

The cumulative distribution function is the regularized gamma function:

F(x;\alpha,\theta) = \int_0^x f(u;\alpha,\theta),du = \frac{\gamma{\left(\alpha, \frac{x}{\theta}\right)}}{\Gamma(\alpha)},

where \gamma{\left(\alpha, \frac{x}{\theta}\right)} is the lower incomplete gamma function.

It can also be expressed as follows, if α is a positive integer (i.e., the distribution is an Erlang distribution):

F(x;\alpha,\theta) = 1-\sum_{i=0}^{\alpha-1} \frac{1}{i!} \left(\frac{x}{\theta} \right)^i e^{-x/\theta} = e^{-x/\theta} \sum_{i=\alpha}^\infty \frac{1}{i!} \left( \frac{x}{\theta} \right)^i.

Both parametrizations are common because either can be more convenient depending on the situation.

Properties

Mean and variance

The mean of gamma distribution is given by the product of its shape and scale parameters: \mu = \alpha\theta = \alpha/\lambda The variance is: \sigma^2 = \alpha \theta^2 = \alpha/\lambda^2 The square root of the inverse shape parameter gives the coefficient of variation: \sigma/\mu = \alpha^{-0.5} = 1/\sqrt{\alpha}

Skewness

The skewness of the gamma distribution only depends on its shape parameter, α, and it is equal to 2/\sqrt{\alpha}.

Higher moments

The r-th raw moment is given by: : \mathrm{E}[X^r] = \theta^r \frac{\Gamma(\alpha+r)}{\Gamma(\alpha)} = \theta^r \alpha^\overline{r} with \alpha^\overline{r} the rising factorial.

Median approximations and bounds

Bounds and asymptotic approximations to the median of the gamma distribution. The cyan-colored region indicates the large gap between published lower and upper bounds before 2021.

Unlike the mode and the mean, which have readily calculable formulas based on the parameters, the median does not have a closed-form equation. The median for this distribution is the value \nu such that \frac{1}{\Gamma(\alpha) \theta^\alpha} \int_0^{\nu} x^{\alpha - 1} e^{-x/\theta} dx = \frac{1}{2}.

A rigorous treatment of the problem of determining an asymptotic expansion and bounds for the median of the gamma distribution was handled first by Chen and Rubin, who proved that (for \theta = 1) \alpha - \tfrac{1}{3} where \mu(\alpha) = \alpha is the mean and \nu(\alpha) is the median of the \text{Gamma}(\alpha,1) distribution. For other values of the scale parameter, the mean scales to \mu = \alpha\theta, and the median bounds and approximations would be similarly scaled by θ.

K. P. Choi found the first five terms in a Laurent series asymptotic approximation of the median by comparing the median to Ramanujan's \theta function. Berg and Pedersen found more terms: \begin{align} \nu(\alpha) = \alpha & - \frac{1}{3} + \frac{8}{405} \alpha^{-1} + \frac{184} \alpha^{-2} + \frac{2248} \alpha^{-3} \[1ex] & - \frac{19,006,408} \alpha^{-4} - \mathcal{O}{\left(\alpha^{-5}\right)} + \cdots \end{align}

1=''α'' = 1}} and has maximum relative error of about 0.6%. The cyan shaded region is the remaining gap between upper and lower bounds (or conjectured bounds), including these new bounds and the bounds in the previous figure.

Partial sums of these series are good approximations for high enough α; they are not plotted in the figure, which is focused on the low-α region that is less well approximated.

Berg and Pedersen also proved many properties of the median, showing that it is a convex function of α, and that the asymptotic behavior near \alpha = 0 is \nu(\alpha) \approx e^{-\gamma}2^{-1/\alpha} (where γ is the Euler–Mascheroni constant), and that for all \alpha 0 the median is bounded by \alpha 2^{-1/\alpha} .

A closer linear upper bound, for \alpha \ge 1 only, was provided in 2021 by Gaunt and Merkle, relying on the Berg and Pedersen result that the slope of \nu(\alpha) is everywhere less than 1: \nu(\alpha) \le \alpha - 1 + \log2 ~~ for \alpha \ge 1 (with equality at \alpha = 1) which can be extended to a bound for all \alpha 0 by taking the max with the chord shown in the figure, since the median was proved convex.

An approximation to the median that is asymptotically accurate at high α and reasonable down to \alpha = 0.5 or a bit lower follows from the Wilson–Hilferty transformation: \nu(\alpha) = \alpha \left( 1 - \frac{1}{9\alpha} \right)^3 which goes negative for \alpha .

In 2021, Lyon proposed several approximations of the form \nu(\alpha) \approx 2^{-1/\alpha}(A + B\alpha). He conjectured values of A and B for which this approximation is an asymptotically tight upper or lower bound for all \alpha 0. In particular, he proposed these closed-form bounds, which he proved in 2023:

\nu_{L\infty}(\alpha) = 2^{-1/\alpha} \left(\log 2 - \tfrac{1}{3} + \alpha\right) is a lower bound, asymptotically tight as \alpha \to \infty \nu_U(\alpha) = 2^{-1/\alpha}(e^{-\gamma} + \alpha) \quad is an upper bound, asymptotically tight as \alpha \to 0

Lyon also showed (informally in 2021, rigorously in 2023) two other lower bounds that are not closed-form expressions, including this one involving the gamma function, based on solving the integral expression substituting 1 for e^{-x}: \nu(\alpha) \left( \frac{2}{\Gamma(\alpha+1)} \right)^{-1/\alpha} (approaching equality as k \to 0) and the tangent line at \alpha = 1 where the derivative was found to be \nu^\prime(1) \approx 0.9680448: \nu(\alpha) \ge \nu(1) + (\alpha-1) \nu^\prime(1) \quad (with equality at k = 1) \nu(\alpha) \ge \log 2 + (\alpha-1) \left[\gamma - 2 \operatorname{Ei}(-\log 2) - \log \log 2\right] where Ei is the exponential integral.

Additionally, he showed that interpolations between bounds could provide excellent approximations or tighter bounds to the median, including an approximation that is exact at \alpha = 1 (where \nu(1) = \log 2) and has a maximum relative error less than 0.6%. Interpolated approximations and bounds are all of the form \nu(\alpha) \approx \tilde{g}(\alpha)\nu_{L\infty}(\alpha) + (1 - \tilde{g}(\alpha)) \nu_U(\alpha) where \tilde{g} is an interpolating function running monotonially from 0 at low α to 1 at high α, approximating an ideal, or exact, interpolator g(\alpha): g(\alpha) = \frac{\nu_U(\alpha) - \nu(\alpha)}{\nu_U(\alpha) - \nu_{L\infty}(\alpha)} For the simplest interpolating function considered, a first-order rational function \tilde{g}_1(\alpha) = \frac{\alpha}{b_0 + \alpha} the tightest lower bound has b_0 = \frac{\frac{8}{405} + e^{-\gamma} \log 2 - \frac{\log^2 2}{2}}{e^{-\gamma} - \log 2 + \frac{1}{3}} - \log 2 \approx 0.143472 and the tightest upper bound has b_0 = \frac{e^{-\gamma} - \log 2 + \frac{1}{3}}{1 - \frac{e^{-\gamma} \pi^2}{12}} \approx 0.374654 The interpolated bounds are plotted (mostly inside the yellow region) in the log–log plot shown. Even tighter bounds are available using different interpolating functions, but not usually with closed-form parameters like these.

Summation

If X**i has a Gamma(α**i, θ) distribution for (i.e., all distributions have the same scale parameter θ), then

\sum_{i=1}^N X_i \sim\mathrm{Gamma} \left( \sum_{i=1}^N \alpha_i, \theta \right)

provided all X**i are independent.

For the cases where the X**i are independent but have different scale parameters, see Mathai or Moschopoulos.

The gamma distribution exhibits infinite divisibility.

Scaling

If X \sim \mathrm{Gamma}(\alpha, \theta),

then, for any c 0,

cX \sim \mathrm{Gamma}(\alpha, c,\theta), by moment generating functions,

or equivalently, if

X \sim \mathrm{Gamma}\left( \alpha,\lambda \right) (shape-rate parameterization)

cX \sim \mathrm{Gamma}\left( \alpha, \frac \lambda c \right),

Indeed, we know that if X is an exponential r.v. with rate λ, then cX is an exponential r.v. with rate λ/c; the same thing is valid with Gamma variates (and this can be checked using the moment-generating function, see, e.g.,these notes, 10.4-(ii)): multiplication by a positive constant c divides the rate (or, equivalently, multiplies the scale).

Exponential family

The gamma distribution is a two-parameter exponential family with natural parameters α − 1 and −1/θ (equivalently, α − 1 and −λ), and natural statistics X and ln X.

If the shape parameter α is held fixed, the resulting one-parameter family of distributions is a natural exponential family.

Logarithmic expectation and variance

One can show that

\operatorname{E}[\ln X] = \psi(\alpha) - \ln \lambda

or equivalently,

\operatorname{E}[\ln X] = \psi(\alpha) + \ln \theta

where ψ is the digamma function. Likewise,

\operatorname{var}[\ln X] = \psi^{(1)}(\alpha)

where \psi^{(1)} is the trigamma function.

This can be derived using the exponential family formula for the moment generating function of the sufficient statistic, because one of the sufficient statistics of the gamma distribution is ln x.

Information entropy

The information entropy is

\begin{align} \operatorname{H}(X) & = \operatorname{E}[-\ln p(X)] \[4pt] & = \operatorname{E}[-\alpha \ln \lambda + \ln \Gamma(\alpha) - (\alpha-1)\ln X + \lambda X] \[4pt] & = \alpha - \ln \lambda + \ln \Gamma(\alpha) + (1-\alpha)\psi(\alpha). \end{align}

In the α, θ parameterization, the information entropy is given by

\operatorname{H}(X) =\alpha + \ln \theta + \ln \Gamma(\alpha) + (1-\alpha)\psi(\alpha).

Kullback–Leibler divergence

6}}. The typical asymmetry for the KL divergence is clearly visible.

The Kullback–Leibler divergence (KL-divergence), of Gamma(α**p, λ**p) ("true" distribution) from Gamma(α**q, λ**q) ("approximating" distribution) is given by

\begin{align} D_{\mathrm{KL}}(\alpha_p,\lambda_p; \alpha_q, \lambda_q) = {} & (\alpha_p-\alpha_q) \psi(\alpha_p) - \log\frac{\Gamma(\alpha_p)}{\Gamma(\alpha_q)} \ & {} + \alpha_q \log\frac{\lambda_p}{\lambda_q} + \alpha_p\left(\frac{\lambda_q}{\lambda_p} - 1\right). \end{align}

Written using the α, θ parameterization, the KL-divergence of Gamma(α**p, θ**p) from Gamma(α**q, θ**q) is given by

\begin{align} D_{\mathrm{KL}}(\alpha_p,\theta_p; \alpha_q, \theta_q) = {} & (\alpha_p-\alpha_q)\psi(\alpha_p) - \log\frac{\Gamma(\alpha_p)}{\Gamma(\alpha_q)} \ & {} + \alpha_q \log\frac{\theta_q}{\theta_p} + \alpha_p \left(\frac{\theta_p}{\theta_q} - 1 \right). \end{align}

Laplace transform

The Laplace transform of the gamma PDF, which is the moment-generating function of the gamma distribution, is

F(s) = \operatorname E\left[ e^{-sX} \right] = \frac{1}{\left(1 + \theta s\right)^\alpha} = \left( \frac\lambda{ \lambda + s} \right)^\alpha

(where X is a random variable with that distribution).

Want to explore this topic further?

Ask Mako anything about Gamma distribution — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report