← SciSim / Statistics
Gamma Distribution
Tier: Standard Undergraduate
§1 Interactive Simulation
Parameter 1
Parameter 2
Mean
Variance
Samples
0
Query prob
Parameter 1
Parameter 2
Query x
Speed 20/s
§2 The Idea, Step by Step

Picture a bus stop where buses show up at random, one after another. The wait for a single bus is unpredictable, but suppose you actually need the third bus. How long until it finally arrives? That total waiting time — the sum of several random waits — is exactly what the Gamma distribution describes.

The wait for one event has its own simple law: the exponential distribution. The Gamma distribution stacks several of these waits together. It has two knobs. The shape $\alpha$ says roughly how many events you are waiting for, and the scale $\beta$ says how long each one takes on average. The expected total wait is just their product, the simplest equation here:

$$E[X]=\alpha\beta$$

So if buses average $\beta = 5$ minutes apart and you are waiting for $\alpha = 3$ of them, your expected total wait is $3 \times 5 = 15$ minutes. The spread around that grows too: the variance is $\text{Var}(X)=\alpha\beta^{2}$.

THE PRECISE FORM

The full density allows $\alpha$ to be any positive number, not just a whole count of events:

$$f(x;\alpha,\beta)=\frac{x^{\alpha-1}e^{-x/\beta}}{\beta^{\alpha}\,\Gamma(\alpha)},\quad x>0$$

The $\Gamma(\alpha)$ in the denominator is the gamma function — a smooth generalization of the factorial, with $\Gamma(n)=(n-1)!$ for whole numbers. It is what lets $\alpha$ slide continuously. The shape controls the look of the curve: $\alpha<1$ piles up near zero, $\alpha=1$ is the plain exponential, and large $\alpha$ pushes the bump rightward and makes it look nearly bell-shaped. On the panel above, Parameter 1 is $\alpha$, Parameter 2 is $\beta$, and the Query x slider reads off $P(X\le x)$ from the CDF.

TRY THIS IN THE SIM ABOVE

Set $\alpha=1$ and watch the curve collapse to the exponential — the law for waiting on a single event. Then crank $\alpha$ up toward 10 and see the hump drift right and turn bell-like (the central limit theorem at work as waits add up). Finally, hold $\alpha$ fixed and drag $\beta$ larger: the whole shape stretches to the right because the mean $\alpha\beta$ grows with it.

§3 Mathematical Derivation

Gamma Distribution — Sum of k exponentials; generalized waiting time

$$f(x;\alpha,\beta)=\frac{x^{\alpha-1}e^{-x/\beta}}{\beta^\alpha\Gamma(\alpha)},\quad x>0$$

$E[X]=\alpha\beta,\quad\text{Var}(X)=\alpha\beta^2$

KEY PROPERTIES

This distribution has important theoretical and applied properties. See the simulation tabs to explore how shape changes with parameters.

APPLICATIONS

Sum of k independent Exponential(λ) random variables. Time until k-th event in a Poisson process. Bayesian inference: conjugate prior for Poisson rate λ. Survival analysis baseline hazard. Insurance: total claim amount. Chi-squared is a special case: χ²(k) = Gamma(k/2, 2). Exponential is Gamma(1, 1/λ).

Key Results

Use the interactive simulation above to explore how the PDF shape responds to parameter changes. The Live Sampling tab demonstrates convergence of empirical frequencies to theoretical probabilities.

Ross — A First Course in Probability, 10th ed. 2019
Hogg, McKean & Craig — Introduction to Mathematical Statistics, 8th ed. 2018
DeGroot & Schervish — Probability and Statistics, 4th ed. 2012
§4 FAQ
StatQuest — youtube.com/@statquestSeeing Theory — seeing-theory.brown.edu
§5 Misconceptions & Common Errors
Key Error

Always verify parameter definitions before computing probabilities.
Different textbooks and software packages use different parameterizations. Always check which convention is being used (e.g., rate vs scale for exponential/gamma; shape vs rate for beta). Plug in extreme values and check that the PDF shape matches your expectation.
See the simulation to visualize how parameters affect the distribution shape.

Casella & Berger — Statistical Inference, 2nd ed. 2002
DeGroot & Schervish — Probability and Statistics, 4th ed. 2012