The Gamma distribution is a two-parameter family of continuous probability distributions that generalises the Exponential Distribution. It arises naturally as the sum of independent exponential random variables and is used to model waiting times, lifetimes, and rates.
A random variable \(X\) follows a Gamma distribution with shape parameter \(\alpha > 0\) and rate parameter \(\beta > 0\) if
\[
X \sim \text{Gamma}(\alpha, \beta) \quad \text{or}
\quad X \sim \Gamma(\alpha, \beta).
\]
Parameterisations: The shape-rate form uses \(\alpha\) (shape) and \(\beta\) (rate); the shape-scale form uses \(\alpha\) and \(\theta = 1/\beta\) (scale). We use shape-rate here.
2 Probability Density Function
The probability density function (shape-rate form) is
Interpretation: The shape \(\alpha\) controls how peaked the density is and the rate \(\beta\) sets the scale; for \(\alpha \leq 1\) the density is strictly decreasing, and for \(\alpha > 1\) it is unimodal.
Plotting code
import numpy as npimport matplotlib.pyplot as pltimport seaborn as snsfrom scipy.stats import gammasns.set_style('whitegrid')sns.set_palette('Set2')x = np.linspace(0, 20, 400)fig, ax = plt.subplots(figsize=(7, 4))for a in (1, 2, 5, 9): ax.plot(x, gamma.pdf(x, a, scale=1), lw=2, label=rf'$\alpha = {a}$')ax.set_xlabel('$x$')ax.set_ylabel('$f(x)$')ax.set_title(r'Gamma density ($\beta = 1$)')ax.legend()plt.show()
Density of the Gamma distribution (rate \(\beta = 1\)) for several shape parameters \(\alpha\).
3 Key Properties
The expectation and variance of \(X \sim \text{Gamma}(\alpha, \beta)\) are
In particular, if \(X_1, \ldots, X_n\) are i.i.d. \(\text{Exponential}(\beta)\), then \(X_1 + \cdots + X_n \sim \text{Gamma}(n, \beta)\), so the Gamma distribution models the total of \(n\) independent waiting times.