# Gamma distribution

The gamma distribution is a continuous probability distribution for positive random variables, defined by a shape parameter and a scale (or rate) parameter, whose density behavior depends on its shape: for shape greater than one, it rises from zero to a mode and then falls; for shape one, it decreases from a positive value; and for shape below one, it decreases from infinity. Its tail decays exponentially<sup>[2](https://www.itl.nist.gov/div898/handbook/eda/section3/eda366b.htm)</sup>. It generalizes the exponential distribution, appears naturally as the waiting time until a fixed number of events in a Poisson process, and serves as a lifetime model, a conjugate Bayesian prior for rates, and the response family of gamma regression.

| Key fact | Detail |
|---|---|
| Density (shape–scale) | \( f(t, \alpha, \beta) = \dfrac{1}{\beta^{\alpha}\Gamma(\alpha)}\, t^{\alpha-1} e^{-t/\beta} \), with shape \( \alpha > 0 \) and scale \( \beta > 0 \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup> |
| Mean and variance | \( \alpha\beta \) and \( \alpha\beta^{2} \) in the shape–scale form; equivalently \( a/b \) and \( a/b^{2} \) in the shape–rate form<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup> |
| Special cases | Shape 1 gives the exponential distribution; a chi-square with \( n \) degrees of freedom is a gamma with \( a = n/2 \) and \( b = 0.5 \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup> |
| Integer shape | When the shape is a positive integer the distribution is called the Erlang distribution, used frequently in queuing theory<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup> |
| General form | A three-parameter version adds a location parameter \( \mu \); the case \( \mu = 0 \), \( \beta = 1 \) is the standard gamma<sup>[2](https://www.itl.nist.gov/div898/handbook/eda/section3/eda366b.htm)</sup> |
| Software | R provides dgamma, pgamma, qgamma, and rgamma with shape and scale (or rate = 1/scale); SciPy's gamma takes a single shape parameter plus loc and scale<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dgamma.html)</sup><sup> • </sup><sup>[4](https://docs.scipy.org/doc/tutorial/stats.html)</sup> |

## Parameterizations

Two parameterizations dominate the literature, and mixing them up is a common practical error. In the shape–rate form the density is \( f(t, a, b) = \dfrac{b^{a}}{\Gamma(a)}\, t^{a-1} e^{-bt} \), where \( b \) is a rate; in the shape–scale form the density is \( f(t, \alpha, \beta) = \dfrac{1}{\beta^{\alpha}\Gamma(\alpha)}\, t^{\alpha-1} e^{-t/\beta} \), where the scale \( \beta \) is the reciprocal of the rate. The two describe the same family, related by \( \beta = 1/b \), and the mean and variance follow accordingly: \( a/b \) and \( a/b^{2} \) versus \( \alpha\beta \) and \( \alpha\beta^{2} \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>.

The NIST Engineering Statistics Handbook notes that different authors also use different symbols for the shape and scale parameters, so a written gamma specification should always state which parameterization it uses<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>.

The general three-parameter form adds a location parameter \( \mu \), giving support \( x \ge \mu \) and density \( f(x) = \dfrac{\left(\frac{x-\mu}{\beta}\right)^{\gamma-1} \exp\left(-\frac{x-\mu}{\beta}\right)}{\beta\,\Gamma(\gamma)} \), where \( \gamma \) is the shape, \( \beta \) the scale, and \( \Gamma \) the gamma function \( \Gamma(a) = \int_{0}^{\infty} t^{a-1} e^{-t}\,dt \). Setting \( \mu = 0 \) and \( \beta = 1 \) gives the standard gamma<sup>[2](https://www.itl.nist.gov/div898/handbook/eda/section3/eda366b.htm)</sup>.

## Why the gamma arises

The gamma distribution is the distribution of a sum of independent exponential random variables. When arrivals at a service counter follow a Poisson process, waiting for the fifth customer to show up takes a gamma-distributed length of time, with shape parameter 5 and rate parameter matching the arrival rate<sup>[5](https://archania.org/p/the-symbolic-world/mathematics/distributions/gamma-distribution)</sup>. More generally, if a system has \( n-1 \) standby backup units and the system and all backups have exponential lifetimes with parameter \( \lambda \), the total lifetime has a gamma distribution with \( a = n \) and \( b = \lambda \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>.

This additive property also gives the gamma a physical interpretation as a lifetime model that the Weibull, its main competitor in reliability, lacks: the Weibull is a purely heuristic fit, while the gamma arises as a physical model because sums of exponential lifetimes are gamma distributed<sup>[6](https://www.ncss.com/software/ncss/distribution-fitting-in-ncss/)</sup>.

## Special cases and relatives

Setting the shape to 1 collapses the gamma to the exponential distribution with rate \( b = \lambda \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>. The chi-square distribution is also a special case: a chi-square with \( n \) degrees of freedom is a gamma with \( a = n/2 \) and \( b = 0.5 \), equivalently \( \beta = 2 \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>. When the shape is a positive integer, the distribution is the [Erlang distribution](https://www.edgepedia.org/erlang-distribution), a workhorse of queuing theory<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>.

The family extends in several directions. The generalized gamma adds flexibility in shape and hazard behavior<sup>[7](https://www.ufpe.br/documents/39866/714959/tese015.pdf/2778dee7-5e03-4e74-bc0c-e9ce570c6852)</sup>, and the gamma-normal distribution, the sum of an independent gamma and normal variable, has a pdf expressible through parabolic cylinder functions and is used as a general-purpose model where a gamma-like positive component is contaminated by symmetric noise<sup>[8](https://arxiv.org/abs/2402.11088)</sup>.

## Uses

**Reliability.** The gamma is a flexible life distribution model that can fit some failure data, though it is not widely used as a life distribution model for common failure mechanisms<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>. It competes with the Weibull as a model for lifetime, but because it is more complicated to handle mathematically it has been used less<sup>[6](https://www.ncss.com/software/ncss/distribution-fitting-in-ncss/)</sup>. Its reliability and failure-rate functions follow directly from the density: \( R(t) = 1 - F(t) \) and \( h(t) = f(t)/R(t) \)<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>.

**Bayesian inference.** When a system follows a homogeneous Poisson process with constant repair rate \( \lambda \) and prior information about \( \lambda \) is available, a gamma prior for \( \lambda \) is a convenient and popular choice<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>. The reason is conjugacy: the gamma is the conjugate prior for the Poisson rate, so the posterior is again a gamma and can be written in closed form<sup>[9](https://www.cs.columbia.edu/~blei/fogm/2020F/readings/Efron2018.pdf)</sup>. The conjugacy does not extend to the gamma's own shape parameter, for which no easy-to-use conjugate prior exists<sup>[10](https://arxiv.org/abs/1802.01610)</sup>.

**Regression.** The gamma family is one of the standard exponential-family choices in generalized linear models; statsmodels, for example, offers sm.families.Gamma() with a default link function<sup>[11](https://www.statsmodels.org/stable/glm.html)</sup>. The gamma GLM is widely used for continuous, non-negative, positively skewed responses such as insurance claims and survival data<sup>[12](https://arxiv.org/abs/1804.07780)</sup>, and gamma regression with a log link has been applied to estimating photometric redshifts of galaxies from multi-wavelength photometry<sup>[13](https://arxiv.org/abs/1409.7699)</sup>.

**Environmental data.** The gamma distribution remains a popular choice for modeling rainfall amounts because of its flexibility and its ability to capture the skewness of rainfall observations<sup>[14](https://arxiv.org/abs/2607.04226)</sup>.

## Estimation

Parameters are usually estimated by maximum likelihood, with the method of moments as a starting point. A quick moment-based estimate of the shape is \( \hat{\alpha} = \left[ \bar{t}/s_{t} \right]^{2} \), the squared ratio of the mean failure time to the standard deviation of the failure times<sup>[1](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)</sup>. In a two-parameter maximum likelihood fit, the method-of-moments values \( \alpha_{0} = \bar{x}^{2}/\mathrm{var}(x) \) and \( \lambda_{0} = \bar{x}/\mathrm{var}(x) \) serve as numerical starting points, and the theoretical [Fisher information](https://www.edgepedia.org/fisher-information) matrix involves the trigamma function of the shape estimate<sup>[15](https://www.stat.umn.edu/geyer/s10/5102/examp/like.html)</sup>.

Estimation is not always well behaved. For the three-parameter gamma, limitations of the likelihood mean that in general very large sample sizes may be needed to avoid inference problems<sup>[16](https://www.tandfonline.com/doi/abs/10.1080/00949650213534)</sup>. In distribution fitting, model choice among gamma, Weibull, exponential, and lognormal candidates is typically made by comparing AIC and BIC values and goodness-of-fit statistics such as Kolmogorov–Smirnov, Cramér–von Mises, and Anderson–Darling; in one worked example the gamma had the smallest test statistics but the exponential had the lower BIC, and the differences among the three were small<sup>[17](https://educatus.github.io/simulation-book/chapter5.html)</sup>.

## References

1. [8.1.6.5. Gamma, NIST Engineering Statistics Handbook](https://itl.nist.gov/div898/handbook/apr/section1/apr165.htm)
2. [1.3.6.6.11. Gamma Distribution, NIST Engineering Statistics Handbook](https://www.itl.nist.gov/div898/handbook/eda/section3/eda366b.htm)
3. [The Gamma Distribution, R stats documentation](https://stat.ethz.ch/R-manual/R-devel/library/stats/help/dgamma.html)
4. [Statistics (scipy.stats), SciPy documentation](https://docs.scipy.org/doc/tutorial/stats.html)
5. [Gamma distribution, Archania](https://archania.org/p/the-symbolic-world/mathematics/distributions/gamma-distribution)
6. [Gamma Distribution Fitting, NCSS Statistical Software](https://www.ncss.com/software/ncss/distribution-fitting-in-ncss/)
7. [Generalized gamma distribution thesis, Federal University of Pernambuco](https://www.ufpe.br/documents/39866/714959/tese015.pdf/2778dee7-5e03-4e74-bc0c-e9ce570c6852)
8. [Properties and maximum likelihood estimation of the gamma-normal and related probability distributions, arXiv](https://arxiv.org/abs/2402.11088)
9. [Exponential Families in Theory and Practice, Bradley Efron (2018)](https://www.cs.columbia.edu/~blei/fogm/2020F/readings/Efron2018.pdf)
10. [Fast and accurate approximation of the full conditional for gamma shape parameters, arXiv](https://arxiv.org/abs/1802.01610)
11. [Generalized Linear Models, statsmodels documentation](https://www.statsmodels.org/stable/glm.html)
12. [Generalized Linear Model for Gamma Distributed Variables via Elastic Net Regularization, arXiv](https://arxiv.org/abs/1804.07780)
13. [The Overlooked Potential of Generalized Linear Models in Astronomy-II: Gamma regression and photometric redshifts, arXiv](https://arxiv.org/abs/1409.7699)
14. [Minimum Density Power Divergence Estimation for the Gamma Distribution with Applications to Robust Rainfall Modeling, arXiv](https://arxiv.org/abs/2607.04226)
15. [Statistics 5102 examples: Maximum Likelihood Estimation, University of Minnesota (Geyer)](https://www.stat.umn.edu/geyer/s10/5102/examp/like.html)
16. [Problems with Maximum Likelihood Estimation and the 3 Parameter Gamma Distribution, Journal of Statistical Computation and Simulation](https://www.tandfonline.com/doi/abs/10.1080/00949650213534)
17. [Estimating probability distributions from data, Simulation for Industrial Engineers](https://educatus.github.io/simulation-book/chapter5.html)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Statistics and probability › Probability theory › Probability distributions › Distribution families and classification › Continuous univariate distribution families*

*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
