Gamma Distribution

A gentle introduction to the gamma distribution, including its definition, special cases, real-world medical applications, and the additive property that reveals its intuitive meaning.

Probability DistributionsGamma DistributionChi-square DistributionIntermediate

What Is the Gamma Distribution?

The gamma distribution is a continuous probability distribution that models the total waiting time until a specific number of events occur.

It is one of the most versatile distributions in statistics and can describe a wide range of phenomena. In fact, both the exponential distribution and the chi-square distribution are special cases of the gamma distribution.


Applications in Medicine and Biostatistics

✅ Exponential distribution (Gamma with α=1\alpha = 1)

  • Radiation therapy: Time until the first cancer cell is destroyed by a dose.
  • Emergency room arrivals: Time until the next patient arrives.

This models the time until the first event occurs.

✅ Gamma distribution (integer α=n\alpha = n)

  • Vaccine response time: Total time needed after multiple doses for the immune system to respond.
  • Multistep treatment durations: Total time required for multiple phases of a treatment to complete.

This models the time until the nn-th event occurs.

✅ Chi-square distribution (Gamma with α=k/2,β=1/2\alpha = k/2, \beta = 1/2)

  • Clinical trials: Statistical testing (e.g. χ2\chi^2 test) for differences between treatment and control groups.
  • Genetic association studies: Testing whether a gene is significantly associated with a disease.

This models the total squared variation in independent normal variables.


Probability Density Function

The gamma distribution is defined by the following probability density function:

f(x;α,β)=βαΓ(α)xα1eβx,x>0f(x; \alpha, \beta) = \frac{\beta^\alpha}{\Gamma(\alpha)} x^{\alpha - 1} e^{-\beta x}, \quad x > 0
  • α>0\alpha > 0: shape parameter
  • β>0\beta > 0: rate parameter
  • Γ(α)\Gamma(\alpha): gamma function, where Γ(n)=(n1)!\Gamma(n) = (n-1)! if nn is an integer

This formula defines a family of curves depending on α\alpha and β\beta.


Special Cases of the Gamma Distribution

Exponential distribution: α=1\alpha = 1

f(x;1,β)=βeβxf(x; 1, \beta) = \beta e^{-\beta x}

Models the time until the first event.

Chi-square distribution: α=k2,β=12\alpha = \frac{k}{2}, \beta = \frac{1}{2}

χk2Gamma(k2,12)\chi^2_k \sim \mathrm{Gamma}\left(\frac{k}{2}, \frac{1}{2}\right)

The sum of kk squared standard normal variables.


Visualizing the Gamma Distribution

Interactive Gamma Distribution Explorer

Explore how shape (α) and rate (β) parameters affect the gamma distribution

Current Distribution: Gamma Distribution

Parameters

Statistics

Mean: 2.000
Variance: 2.000
Std Dev: 1.414

Quick Examples

Distribution Visualization

Probability Density Function

f(x; α, β) = (βα / Γ(α)) × xα-1 × e-βx
Mean
μ = α/β
Variance
σ² = α/β²
Current: f(x; 2, 1)

Use the interactive tool above to explore how the shape (α\alpha) and rate (β\beta) affect the distribution.

Quick buttons are also provided to show:

  • Exponential distribution (α=1\alpha = 1)
  • Chi-square distribution (α=k/2\alpha = k/2, β=1/2\beta = 1/2)

Additive Property: The Key to Intuition

The shape parameter α\alpha represents how many events we’re waiting for.

Sum of exponentials → gamma distribution

If XiExp(β)X_i \sim \mathrm{Exp}(\beta) are independent, then:

i=1nXiGamma(n,β)\sum_{i=1}^n X_i \sim \mathrm{Gamma}(n, \beta)

This means: the time until the nn-th event is gamma-distributed.


Proof via Moment Generating Function (MGF)

The MGF of XExp(β)X \sim \mathrm{Exp}(\beta) is:

MX(t)=E[etX]=ββt,t<βM_X(t) = \mathbb{E}[e^{tX}] = \frac{\beta}{\beta - t}, \quad t < \beta

Then the MGF of the sum Sn=XiS_n = \sum X_i is:

MSn(t)=(ββt)nM_{S_n}(t) = \left( \frac{\beta}{\beta - t} \right)^n

This matches the MGF of Gamma(n,β)\mathrm{Gamma}(n, \beta):

MGamma(n,β)(t)=(ββt)nM_{\mathrm{Gamma}(n, \beta)}(t) = \left( \frac{\beta}{\beta - t} \right)^n

So, the sum of exponentials is gamma-distributed.


Mean, Variance, and Their Intuitive Meaning

Once we understand the gamma distribution as the sum of exponential waiting times, it’s natural to ask: how do the parameters α\alpha and β\beta affect the average and the spread?

📌 Mean and Variance

For XGamma(α,β)X \sim \mathrm{Gamma}(\alpha, \beta) (with rate parameter β\beta), we have:

E[X]=αβ,Var(X)=αβ2\mathbb{E}[X] = \frac{\alpha}{\beta}, \quad \mathrm{Var}(X) = \frac{\alpha}{\beta^2}

Let’s break this down:

  • α\alpha: the number of events we are waiting for
  • β\beta: the rate at which events occur per unit time

🔄 Scaling and the Role of β\beta

We can derive the variance formula using a change of variables. Let YGamma(α,1)Y \sim \mathrm{Gamma}(\alpha, 1) and define:

X=1βYX = \frac{1}{\beta} Y

This means we’re slowing down time by a factor of β\beta.

Using the change of variables formula with the Jacobian:

fX(x)=fY(βx)ddx(βx)=fY(βx)βf_X(x) = f_Y(\beta x) \cdot \left| \frac{d}{dx} (\beta x) \right| = f_Y(\beta x) \cdot \beta

Since:

fY(y)=1Γ(α)yα1eyf_Y(y) = \frac{1}{\Gamma(\alpha)} y^{\alpha - 1} e^{-y}

we get:

fX(x)=βαΓ(α)xα1eβxf_X(x) = \frac{\beta^\alpha}{\Gamma(\alpha)} x^{\alpha - 1} e^{-\beta x}

which is exactly the density of Gamma(α,β)\mathrm{Gamma}(\alpha, \beta).

Now, from a standard rule in probability:

If X=cY, then Var(X)=c2Var(Y)\text{If } X = cY, \text{ then } \mathrm{Var}(X) = c^2 \mathrm{Var}(Y)

So:

Var(X)=(1β)2α=αβ2\mathrm{Var}(X) = \left( \frac{1}{\beta} \right)^2 \cdot \alpha = \frac{\alpha}{\beta^2}

🎯 Intuition: Why is the variance inversely proportional to β2\beta^2?

  • Increasing α\alpha means waiting for more events → more total time and more variability
  • Increasing β\beta means time moves faster (events occur more frequently)
    → waiting time becomes shorter and more consistent

But here’s the key:

  • Mean is like a “length” → it scales linearly with time: E[X]=αβ\mathbb{E}[X] = \frac{\alpha}{\beta}
  • Variance is like “spread in squared units” → it scales with the square of time

So doubling the speed (β2β\beta \to 2\beta) makes the mean half as long, but the variance one-fourth as wide.

This is why:

Var(X)=αβ2\mathrm{Var}(X) = \frac{\alpha}{\beta^2}

and not just αβ\frac{\alpha}{\beta}.


Understanding this scaling helps build strong intuition for how gamma models respond to changes in event frequency and cumulative wait time.


Summary

  • The gamma distribution models total waiting time until a number of events occur.
  • It generalizes both the exponential and chi-square distributions.
  • It is widely used in medicine, from modeling treatment durations to statistical testing.
  • The additive property reveals the intuitive meaning of the shape parameter: how many events you’re waiting for.
  • The mean and variance depend on both α\alpha and β\beta, with variance inversely proportional to β2\beta^2—capturing how faster event rates reduce uncertainty more rapidly.
← Back to Encyclopedia