Gamma Distribution Calculator

Gamma distribution CDF P(X ≤ x), upper tail, pdf, mean, variance, mode, median and percentiles, from shape k and scale θ or rate β.

Greater than 0. A whole-number shape k is the waiting time for the k-th event of a Poisson process (Erlang).
Greater than 0, in the same unit as x. Mean = k·θ.
Zero or more.
%
For example 95 gives the value that 95% of X falls below.

Results

P(X ≤ 5)
0.496332
P(X > 5)
0.503668
Probability density f(x)
0.104931
95th percentile
14.232
Mean = kθ
6
Variance = kθ²
18
Standard deviation = θ√k
4.2426
Mode = (k − 1)θ
3
Median
5.035
Parameters used
shape k = 2, scale θ = 3, rate β = 1/θ = 0.333333

How it’s calculated

The gamma distribution models positive, right-skewed quantities such as waiting times, rainfall totals, insurance claim sizes and service times. With a whole-number shape k it is the waiting time until the k-th event of a Poisson process (the Erlang distribution); with k = 1 it is the exponential distribution, and the chi-square distribution with ν degrees of freedom is a gamma with k = ν/2 and θ = 2.

Books use two parameterizations. This page uses shape k and scale θ (NIST writes γ and β for these); if your source gives a shape α and a rate β, choose that option: the scale is θ = 1/β. Check which one you have, because the mean is kθ but α/β.

PDF f(x) = x^(k−1)·e^(−x/θ) / (Γ(k)·θ^k) CDF F(x) = P(k, x/θ), the regularized lower incomplete gamma function Mean kθ Variance kθ² Mode (k − 1)θ for k ≥ 1 Median and percentiles: solve F(x) = p numerically

Worked example: shape k = 2 and scale θ = 3 (mean 6). For a whole-number shape the CDF has a closed form, F(5) = 1 − e^(−5/3)·(1 + 5/3) = 1 − 0.188876 × 2.666667 = 0.496332, and the pdf is 5·e^(−5/3)/9 = 0.104931. The variance is 2 × 9 = 18, so the standard deviation is 4.2426.

Frequently asked questions

Scale or rate: which do I have?

If the mean is shape × parameter, the parameter is a scale θ. If the mean is shape ÷ parameter, it is a rate β = 1/θ. Spreadsheet functions such as GAMMA.DIST use a scale; many statistics texts use a rate.

How is the gamma related to the exponential and chi-square?

Shape 1 gives the exponential distribution with mean θ. A chi-square with ν degrees of freedom is a gamma with shape ν/2 and scale 2. A sum of k independent exponentials with mean θ is gamma with shape k and scale θ.

How are the median and percentiles found?

There is no closed formula, so the calculator solves P(X ≤ x) = p by repeated halving (bisection) of an interval on the incomplete gamma function, to about 15 significant digits.

How do I estimate the shape and scale from data?

The method of moments gives k ≈ (mean ÷ standard deviation)² and θ ≈ variance ÷ mean. Maximum likelihood estimates are better but need software.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator