Updated
In this lesson
Wide tables, equations, and code scroll sideways. Swipe, or Tab to focus them and use the left and right arrow keys.
Gamma distribution
You will learn: Interpret gamma shape and rate and connect integer shapes to accumulated waits.
Start with: Exponential distribution
For a positive integer k, Gamma(k, λ) is the waiting time to the k-th event of a homogeneous Poisson process with rate λ. The family also permits any positive real shape k. Set k=1 and you recover the Exponential distribution exactly.
Build a waiting time from its gaps
Rate λ = 1 events per minute; scale = 1.0000 minutes. Both conventions describe the same distribution. Mean = shape × scale.
| Event | Gap (minutes) | Arrival time (minutes) |
|---|---|---|
| 1 | 1.1555 | 1.1555 |
| 2 | 0.3607 | 1.5162 |
Each gap has exponential rate 1. Adding 2 gaps produces one gamma waiting time. Changing the rate replays the same underlying randomness at a new time scale.
The density plot begins at 0.001 and ends at 8; the distribution extends beyond that window. At shape below 1 its density diverges as x approaches zero, while total area remains one. 0 of 500 samples are above the displayed range.
What to notice
- k=1: reduces exactly to Exponential(λ) — a rapidly decaying curve.
- Integer k (Erlang): the distribution of the sum of k independent Exp(λ) random variables. Modes and peaks become more pronounced.
- Large k: after centering and dividing by its standard deviation, the gamma distribution approaches standard normal. For integer shapes this follows from summing independent common-rate exponential waits. Finite shapes remain right-skewed.
- Rate λ stretches or compresses the x-axis without changing the shape. Mean = , Variance = .
Family connections
The Gamma family intersects much of probability theory:
- k=1: Exponential(λ)
- k=n/2, λ=1/2: Chi-squared(n) — used in statistical tests
- k=α, λ=β: the conjugate prior for the Poisson rate parameter in Bayesian statistics
- k → ∞: the centered, standardized distribution approaches standard normal
Shape parameter k
For non-integer k the distribution is defined via the Gamma function Γ(k) — the continuous extension of the factorial: Γ(n) = (n−1)! for integer n. The shape changes the skew and behavior near zero; it is not a count of modes. Fractional k arises naturally in Bayesian inference as a posterior distribution over rates.
The distribution relationship map states the common-rate and integer-shape conditions for adding exponential waits.
Rate and scale give different numbers for the same model
For shape 3 and rate 2 events per minute, the scale is 1/2 minute. Mean waiting time is 3/2=1.5 minutes and variance is 3/4=0.75 square minutes. A function expecting scale should receive 0.5, not 2. Always inspect the convention before copying a parameter between tools.
The event “the third arrival occurs by two minutes” is the same as “at least three events occur in two minutes.” The latter count is Poisson(4), giving 1−exp(−4)(1+4+4²/2), about 76.19%. This links a waiting-time probability to a count without assuming that count and time are the same random variable.
A sum requires the same rate
Two independent waits with rates 1 and 2 have means 1 and 0.5 and variances 1 and 0.25. Their sum therefore has mean 1.5 and variance 1.25. A two-stage gamma with mean 1.5 would have rate 4/3 and variance 1.125, so it cannot be that same distribution. The common-rate condition in the Erlang construction does real work.
Shape 0.5 is valid but has no literal half-arrival interpretation. At rate 0.5 it is chi-squared with one degree of freedom. Its density is unbounded near zero, yet the probability over shrinking intervals tends to zero. Density height and probability are different quantities.
Make a prediction
If the rate doubles while shape stays fixed, does the variance halve?
Explore the answer
The mean halves, but the variance falls to one quarter because it is shape divided by rate squared. The standard deviation halves, in the same units as the waiting time.
References
NIST: gamma distribution states the scale convention and moments. Random Services: gamma waits develops the independent exponential-sum construction.