Quant Memo
Core

The Gamma Distribution

The waiting-time distribution for "the k-th event" — a flexible, always-positive shape that generalizes the exponential distribution and underlies option-pricing tools like the chi-squared and the CIR interest-rate model.

Prerequisites: Expectation, Variance & Moments

Trade fills on a thin order book don't arrive on a fixed schedule — they arrive at random, one at a time. The exponential distribution models the wait for a single fill. But what if you care about the wait for the fifth fill, or you want a flexible, always-positive shape for a quantity like realized variance that can't be normal (since variance can't go negative)? Both needs point to the same distribution: the gamma.

The analogy: waiting for the k-th bus

If buses arrive at random, independent intervals (a Poisson process) with an average wait of 1/λ1/\lambda between each, the exponential distribution tells you how long until the next bus. The gamma distribution tells you how long until the kk-th bus arrives — the sum of kk independent exponential waits stacked end to end. As kk grows, that sum smooths out (by a CLT-like effect) from a sharply skewed shape into something closer to a bell curve, but for small kk it stays distinctly right-skewed — exactly the shape you'd expect for "total time until several things have happened."

Writing it down

The gamma distribution with shape kk (or α\alpha) and rate λ\lambda (or scale θ=1/λ\theta = 1/\lambda) has density

f(x;k,λ)=λkxk1eλxΓ(k),x>0,f(x; k, \lambda) = \frac{\lambda^k x^{k-1} e^{-\lambda x}}{\Gamma(k)}, \qquad x > 0,

where Γ(k)\Gamma(k) is the gamma function, a continuous generalization of factorial (Γ(k)=(k1)!\Gamma(k) = (k-1)! for integer kk). In words: the density rises like xk1x^{k-1} (governed by shape) and decays like eλxe^{-\lambda x} (governed by rate), with Γ(k)\Gamma(k) just a normalizing constant so the total probability integrates to 1. Mean is k/λk/\lambda, variance is k/λ2k/\lambda^2. Two special cases matter: k=1k=1 recovers the exponential distribution exactly, and setting k=ν/2k = \nu/2, λ=1/2\lambda = 1/2 recovers the chi-squared distribution with ν\nu degrees of freedom.

Function explorer
-224.4
x = 1.00f(x) = 1.000

The rising-then-falling shape here mirrors gamma's density for small shape kk: a fast rise from zero (no mass exactly at zero once k>1k>1), a peak, then an exponential-style decay — try different exponents mentally as different values of kk and watch the peak shift right and the tail thin as kk grows.

Worked example 1: waiting for the fifth trade

A stock's trades on a thin book arrive as a Poisson process averaging λ=2\lambda = 2 per minute. The time until the 5th trade is Gamma(k=5,λ=2)\text{Gamma}(k=5, \lambda=2), with mean 5/2=2.55/2 = 2.5 minutes and variance 5/4=1.255/4=1.25 minutes², so a standard deviation of about 1.121.12 minutes. A trader waiting for enough liquidity to accumulate (5 trades' worth) should plan around 2.5 minutes, but be prepared for real waits ranging roughly 1.4 to 3.6 minutes (mean ± 1 sd) fairly often, since the distribution is still visibly right-skewed at k=5k=5.

Worked example 2: modeling realized variance

Daily realized variance estimates from intraday returns are strictly positive and right-skewed — never normal. Suppose historical data fits a Gamma(k=4,λ=800)\text{Gamma}(k=4, \lambda=800) to daily variance (in return² units), giving mean 4/800=0.0054/800 = 0.005 (matching an average daily vol near 0.0057.1%\sqrt{0.005}\approx 7.1\%, unrealistically high here for illustration — treat as stylized). What's the probability realized variance exceeds double its mean, i.e. x>0.01x > 0.01? Using the gamma CDF (from tables or software) for k=4,λ=800k=4,\lambda=800 at x=0.01x=0.01: P(X>0.01)0.091P(X>0.01) \approx 0.091 — about a 9% chance on any given day, a number a normal-based model applied to variance (which would nonsensically allow negative variance) simply cannot produce honestly.

Distribution · poisson
mean 4.0024681012outcomes (k) →
mean 4.00std dev 2.00peak at k = 3

This is the discrete cousin of the story: a Poisson count with rate λ\lambda counts how many events land in a fixed window, while the gamma distribution with the same rate measures the waiting time until a fixed number of events land — two sides of the same arrival process, one counting, one timing.

What this means in practice

  • Modeling any strictly-positive, skewed quantity. Trade durations, time-to-fill, drawdown recovery times, realized variance — anywhere a normal distribution's negative tail is nonsensical, gamma is a natural default.
  • Bayesian priors. The gamma distribution is the conjugate prior for the rate of a Poisson process (like arrival rate of trades or defaults), making posterior updates closed-form and fast.
  • Interest rate models. The Cox-Ingersoll-Ross (CIR) short-rate model's stationary distribution is a gamma distribution, which is exactly why CIR rates stay positive while mean-reverting.

The gamma distribution is the waiting time for the kk-th event in a Poisson process — a sum of kk independent exponentials — giving a flexible, always-positive, right-skewed shape controlled by a shape parameter kk and a rate λ\lambda, with the exponential and chi-squared distributions as special cases.

Shape and rate parameterizations are easy to mix up across software packages — some parameterize by rate λ\lambda (mean =k/λ=k/\lambda), others by scale θ=1/λ\theta = 1/\lambda (mean =kθ=k\theta). Silently plugging a rate into a function expecting a scale (or vice versa) changes the mean by a factor that can be enormous, and the resulting fit will look plausible enough not to raise obvious alarms — always check your library's convention before trusting a fitted gamma parameter.

Related concepts

Practice in interviews

Further reading

  • Casella, Berger, Statistical Inference (ch. 3)
  • Ross, Introduction to Probability Models (ch. 5)
ShareTwitterLinkedIn