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: With a shape parameter and a scale parameter With a shape parameter 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 base measure) for a random variable 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 that is gamma-distributed with shape and rate is denoted

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

where is the gamma function. For all positive integers, .

The cumulative distribution function is the regularized gamma function:

where 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:

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

The probability density function using the shape-scale parametrization is

Here is the gamma function evaluated at .

The cumulative distribution function is the regularized gamma function:

where 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):

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:

The variance is:

The square root of the inverse shape parameter gives the coefficient of variation:

Skewness The skewness of the gamma distribution only depends on its shape parameter, , and it is equal to

Higher moments The -th raw moment is given by:

with the rising factorial.

Cumulants The -th cumulant is given by: .

Median approximations and bounds

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 such that

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 )

where is the mean and is the median of the distribution. For other values of the scale parameter, the mean scales to , 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 function. Berg and Pedersen found more terms:

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 is (where is the Euler–Mascheroni constant), and that for all the median is bounded by .

A closer linear upper bound, for only, was provided in 2021 by Gaunt and Merkle, relying on the Berg and Pedersen result that the slope of is everywhere less than 1: for (with equality at ) which can be extended to a bound for all 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 or a bit lower follows from the Wilson–Hilferty transformation:

which goes negative for .

In 2021, Lyon proposed several approximations of the form . He conjectured values of and for which this approximation is an asymptotically tight upper or lower bound for all . In particular, he proposed these closed-form bounds, which he proved in 2023:

is a lower bound, asymptotically tight as is an upper bound, asymptotically tight as

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 : (approaching equality as ) and the tangent line at where the derivative was found to be : (with equality at )

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 (where ) and has a maximum relative error less than 0.6%. Interpolated approximations and bounds are all of the form

where is an interpolating function running monotonially from 0 at low to 1 at high , approximating an ideal, or exact, interpolator :

For the simplest interpolating function considered, a first-order rational function

the tightest lower bound has

and the tightest upper bound has

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 has a distribution for (i.e., all distributions have the same scale parameter ), then

provided all are independent.

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

The gamma distribution exhibits infinite divisibility.

Scaling If

then, for any ,

by moment generating functions,

or equivalently, if

(shape-rate parameterization)

Indeed, we know that if is an exponential r.v. with rate , then is an exponential r.v. with rate ; 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 divides the rate (or, equivalently, multiplies the scale).

Exponential family The gamma distribution is a two-parameter exponential family with natural parameters and (equivalently, and ), and natural statistics and .

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

or equivalently,

where is the digamma function. Likewise,

where 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 .

Information entropy The information entropy is

In the , parameterization, the information entropy is given by

Kullback–Leibler divergence

The Kullback–Leibler divergence (KL-divergence), of ("true" distribution) from ("approximating" distribution) is given by

Written using the , parameterization, the KL-divergence of from is given by

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

(where is a random variable distributed as , or equivalently ).

Full width at half maximum The full width at half maximum of a unimodal probability distribution is the difference between the two values of the support that produce an output of half the function's maximum value when evaluated by the distribution's probability density function. For the gamma distribution with shape parameter , the FWHM is

When , the gamma distribution reduces to an exponential distribution, whose FWHM is

When , the gamma distribution has no finite mode and therefore no well-defined FWHM.

Related distributions

General Let be independent and identically distributed random variables following an exponential distribution with rate parameter β, then where n is the shape parameter and is the rate, and . If (in the shape–rate parametrization), then has an exponential distribution with rate parameter . In the shape-scale parametrization, has an exponential distribution with rate parameter . If (in the shape–scale parametrization), then is identical to , the chi-squared distribution with degrees of freedom. Conversely, if and is a positive constant, then . If , one obtains the Schulz-Zimm distribution, which is most prominently used to model polymer chain lengths. If is an integer, the gamma distribution is an Erlang distribution and is the probability distribution of the waiting time until the -th "arrival" in a one-dimensional Poisson process with intensity . If

then

If has a Maxwell–Boltzmann distribution with parameter , then

If , then follows a log-gamma distribution. If , then follows an exponential-gamma (abbreviated exp-gamma) distribution. It is sometimes incorrectly referred to as the log-gamma distribution. Formulas for its mean and variance are in the section #Logarithmic expectation and variance. If , then follows a generalized gamma distribution with parameters , , and . More generally, if , then for follows a generalized gamma distribution with parameters , , and . If with shape and scale , then (see Inverse-gamma distribution for derivation). Parametrization 1: If are independent, then , or equivalently, Parametrization 2: If are independent, then , or equivalently, If and are independently distributed, then has a beta distribution with parameters and , and is independent of , which is -distributed. If and , then converges in distribution to defined under parametrization 2. If are independently distributed, then the vector (, where , follows a Dirichlet distribution with parameters . For large the gamma distribution converges to normal distribution with mean and variance . The gamma distribution is the conjugate prior for the precision of the normal distribution with known mean.