Continuous distribution

Gamma distribution

The waiting time until the -th event of a Poisson process with rate , or the sum of independent exponential waits. With non-integer it is a general-purpose model for positive, right-skewed quantities such as rainfall or insurance claims, and it is the conjugate prior for a Poisson rate.

Gamma probability calculator

P(X ≤ 1.7) = 0.506754

At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends.

PDF

00.10.20.30246810f(x)mean

CDF

00.250.50.7510246810F(x)

mean 2 · variance 2 · sd 1.414 · mode 1 · entropy 1.577 nats

Formulas

Parameters
  • , the shape
  • , the rate (some books use the scale )
Support
PDF
CDF
Mean
Variance
Mode
MGF
Entropy

is the regularized lower incomplete gamma function and the digamma function.

Worked example

Customers arrive at 2 per minute. What is the probability the third customer has arrived within 1 minute?

The wait is Gamma. It is at most 1 minute exactly when at least 3 arrive in the first minute, a Poisson(2) count: answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.gamma(a=2, scale=1/1)
X.pdf(1.5)  # f(1.5) = 0.3347
X.cdf(1.5)  # P(X ≤ 1.5) = 0.4422
X.mean(), X.var()  # 2, 2
X.ppf(0.95)  # 95th percentile
X.rvs(size=10, random_state=0)

rng = np.random.default_rng(0)
rng.gamma(shape=2, scale=1/1, size=10)

Both libraries take the scale 1/β, not the rate.

Choosing between this and its neighbours? Which distribution for waiting times and lifetimes? · Which prior distribution should I use?

← ExponentialErlang →