Gamma distribution
From Wikipedia, the free encyclopedia
| Probability density function |
|
| Cumulative distribution function |
|
| Parameters | shape (real) scale (real) |
|---|---|
| Support | ![]() |
| Probability density function (pdf) | ![]() |
| Cumulative distribution function (cdf) | ![]() |
| Mean | ![]() |
| Median | no simple closed form |
| Mode | for ![]() |
| Variance | ![]() |
| Skewness | ![]() |
| Excess kurtosis | ![]() |
| Entropy | ![]() ![]() |
| Moment-generating function (mgf) | for ![]() |
| Characteristic function | ![]() |
In probability theory and statistics, the gamma distribution is a two-parameter family of continuous probability distributions that represents the sum of k exponentially distributed random variables, each of which has mean θ.
Contents |
The probability density function of the gamma distribution can be expressed in terms of the gamma function:
where k > 0 is the shape parameter and θ > 0 is the scale parameter of the gamma distribution. (This parameterization is used in the infobox and the plots.)
Alternatively, the gamma distribution can be parameterized in terms of a shape parameter α = k and an inverse scale parameter β = 1 / θ, called a rate parameter:
Both parameterizations are common because either can be more convenient depending on the situation.
The cumulative distribution function can be expressed in terms of the incomplete gamma function,
If Xi has a Gamma(αi, β) distribution for i = 1, 2, ..., N, then
provided all Xi are independent.
The gamma distribution exhibits infinite divisibility.
For any t > 0 it holds that tX is distributed Gamma(k, tθ). That demonstrates that θ is a scale parameter.
The Gamma distribution is a two-parameter exponential family with natural parameters k − 1 and 1 / θ, and natural statistics X and ln(X).
The information entropy is given by:
where ψ(k) is the digamma function.
The directed Kullback-Leibler divergence between Gamma(α0, β0) and Gamma(α, β) is given by
The likelihood function for N iid observations
is
from which we calculate the log-likelihood function
Finding the maximum with respect to θ by taking the derivative and setting it equal to zero yields the maximum likelihood estimate of the θ parameter:
Substituting this into the log-likelihood function gives:
Finding the maximum with respect to k by taking the derivative and setting it equal to zero yields:
where
is the digamma function.
There is no closed-form solution for k. The function is numerically very well behaved, so if a numerical solution is desired, it can be found using, for example, Newton's method. An initial value of k can be found either using the method of moments, or using the approximation:
If we let
then k is approximately
which is within 1.5% of the correct value.[citation needed] An explicit form for the Newton-Raphson update of this initial guess is given by Choi and Wette (1969) as the following expression
where
denotes the trigamma function (the derivative of the digamma function).
The digamma and trigamma functions can be difficult to calculate with high precision. However, approximations known to be good to several significant figures can be computed using the following approximation formulae:
and
For details, see Choi and Wette (1969).
Given the scaling property above, it is enough to generate Gamma variables with β = 1 as we can later convert to any value of β with simple division.
Using the fact that a Gamma(1, 1) distribution is the same as an Exp(1) distribution, and noting the method of generating exponential variables, we conclude that if U is uniformly distributed on (0, 1], then ln(U) is distributed Gamma(1, 1). Now, using the "α-addition" property of Gamma distribution, we expand this result:
where Uk are all uniformly distributed on (0, 1] and independent.
All that is left now is to generate a variable distributed as Gamma(δ, 1) for 0 < δ < 1 and apply the "α-addition" property once more. This is the most difficult part.
We provide an algorithm without proof. It is an instance of the acceptance-rejection method:
- Let m be 1.
- Generate V2m − 1 and V2m — independent uniformly distributed on (0, 1] variables.
- If
, where
, then go to step 4, else go to step 5. - Let
. Go to step 6. - Let
. - If
, then increment m and go to step 2. - Assume ξ = ξm to be the realization of Gamma(δ,1).
Now, to summarize,
where [k] is the integral part of k, and ξ has been generating using the algorithm above with δ = {k} (the fractional part of k), Uk and Vl are distributed as explained above and are all independent.
- If
, then X has an exponential distribution with rate parameter λ. - If
, then X is identical to χ2(ν), the chi-square distribution with ν degrees of freedom. - If k is an integer, the gamma distribution is an Erlang distribution and is the probability distribution of the waiting time until the k-th "arrival" in a one-dimensional Poisson process with intensity 1/θ.
- If
, then X has a Maxwell-Boltzmann distribution with parameter a.
- If X has a Gamma(k, θ) distribution, then 1/X has an inverse-gamma distribution with parameters k and θ-1.
- If X and Y are independently distributed Gamma(α, θ) and Gamma(β, θ) respectively, then X / (X + Y) has a beta distribution with parameters α and β.
- If Xi are independently distributed Gamma(αi,θ) respectively, then the vector (X1 / S, ..., Xn / S), where S = X1 + ... + Xn, follows a Dirichlet distribution with parameters α1, ..., αn. This holds true for any θ.




for 





for 




![\left[ Y = \sum_{i=1}^N X_i \right] \sim \mathrm{Gamma} \left( \sum_{k=1}^N \alpha_i, \beta \right) \,\!](../../../math/9/0/4/904cfb8f85f2d88c499ed05864fc1b2a.png)
![\frac{-1}{\theta^k \Gamma(k)} \int_0^{\infty} \frac{x^{k-1}}{e^{x/\theta}} \left[ (k-1)\ln x - x/\theta - k \ln\theta - \ln\Gamma(k) \right] \,dx \!](../../../math/a/d/8/ad87ea855f71036f04a153cac1f6fb12.png)
![= -\left[ (k-1) (\ln\theta + \psi(k)) - k - k \ln\theta - \ln\Gamma(k) \right] \!](../../../math/3/f/c/3fc6387b0016359b5150ea2a11b18df4.png)















![\theta \left( \xi - \sum _{i=1} ^{[k]} {\ln U_i} \right) \sim \mathrm{Gamma}(k, \theta),](../../../math/9/0/d/90de07e300201e04c2b0bddded65c79c.png)
