Home page for accesible maths 7 Models for continuous random variables

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

7.3 Gamma Distribution: Gamma(α,β)

A random variable X has a gamma distribution with shape parameter α and rate parameter β if its pdf is given by

fX(x)={βαΓ(α)xα-1exp(-βx)x0,0otherwise, (7.1)

where α>0 and β>0. We write XGamma(α,β).

Lemma 7.9 shows directly that

-fX(x)dx = βαΓ(α)0xα-1exp(-βx)
= βαΓ(α)×Γ(α)βα
= 1.

Figure 7.3 shows the pdf for four different sets of parameters.

Figure 7.3: The pdfs for four gamma-distributed random variables X with different parameter values.

The family of gamma distributions provides a flexible class of pdfs which may describe the distribution of a non-negative variable even when there is no strong probability-model-based justification.

Note that when α=1 the gamma distribution reduces to the exponential distribution. However, unlike the exponential distribution we cannot evaluate the cdf in closed form for a general (non-integer) value of α.

The statistical package R has built-in functions for evaluating the pdf, cdf and inverse cdf (for obtaining quantiles) for many common distributions including the gamma distribution:

> dgamma(4,shape=6,rate=1) # pdf of Gam(6,1) evaluated at x=4, i.e. f(4)
[1] 0.1562935
> dgamma(4,6,1)    # pdf of Gam(6,1) evaluated at x=4, i.e. f(4)
[1] 0.1562935
> pgamma(2,0.5,1)  # cdf of Gam(0.5,1) evaluated at x=2, i.e. P(X < 2)
[1] 0.9544997
> qgamma(0.5,3,1)  # the median of the Gamma(3,1) distribution
[1] 2.67406

The rth moment of a gamma random variable is

E(Xr) = -xrfX(x)dx=0xrβαxα-1exp(-βx)/Γ(α)dx
= βαΓ(α)0xr+α-1exp(-βx)dx
= βαΓ(α)×Γ(r+α)βr+α
= Γ(r+α)βrΓ(α).

where the penultimate line follows from Lemma 7.9.

An alternative to remembering or rederiving Lemma 7.9 is to use the unit integrability property of the density (this trick can be useful for densities other than the gamma).

E(Xr) = βαΓ(α)0xr+α-1exp(-βx)dx
= βαΓ(α)×Γ(α+r)βα+r×0βα+rΓ(α+r)xr+α-1exp(-βx)dx
= Γ(α+r)βrΓ(α)×1.

Both approaches result in the same formula for E(Xr), which lets us derive

E(X) = Γ(α+1)βΓ(α)
= αβ,
E(X2) = Γ(α+2)β2Γ(α)
= (α+1)αβ2,
VarX = (α+1)αβ2-α2β2
= αβ2.