Skip to main content

Section 8.4 Gamma Distribution

Extending the exponential distribution model developed above, consider a Poisson Process where you start with an interval of variable length X so that X measures the interval needed in order to obtain the rth success for some natural number r. Then \(R = (0,\infty)\) and the resulting distribution of X will be called a Gamma distribution.

Definition 8.4.1. Gamma Function.
\begin{equation*} \Gamma(t) = \int_0^{\infty} u^{t-1} e^{-u} du \end{equation*}

Letting n be a natural number and applying integration by parts one time gives

\begin{align*} \Gamma(n+1) & = \int_0^{\infty} u^n e^{-u} du\\ & = -u^n \cdot e^{-u} \big |_0^{\infty} + n \int_0^{\infty} u^{n-1} e^{-u} du \\ & = 0 - 0 + n \Gamma(n) \end{align*}

Continuing using an inductive argument to obtain the final result.

To find the probability function for the gamma distribution, once again focus on the development of F(x). Assuming r is a natural number greater than 1 and noting that X measures the interval length needed in order to achieve the rth success

\begin{align*} F(x) & = P(X \le x)\\ & = 1 - P(X \gt x)\\ & = 1 - P(\text{fewer than r successes in [0,x]})\\ & = 1 - \big [ \frac{(\lambda x)^0 e^{-\lambda x}}{0!} + \frac{(\lambda x)^1 e^{-\lambda x}}{1!} + ... + \frac{(\lambda x)^{r-1} e^{-\lambda x}}{(r-1)!} \big ]\\ & = 1 - \sum_{k=0}^{r-1} \frac{(\lambda x)^k e^{-\lambda x}}{k!} \end{align*}

where the discrete Poisson probability function is used on the interval [0,x]. The derivative of this function however is "telescoping" and terms cancel. Indeed,

\begin{align*} F'(x) & = \lambda e^{-\lambda x}/0!\\ & - \lambda e^{-\lambda x}/1! + \lambda x \cdot \lambda e^{-\lambda x}/1!\\ & - \lambda^2 2x e^{-\lambda x}/2! + \lambda^2 x^2 \cdot \lambda e^{-\lambda x}/2!\\ & - \lambda^3 3x^2 e^{-\lambda x}/3! + \lambda^3 x^3 \cdot \lambda e^{-\lambda x}/3!\\ & . . .\\ & - \lambda^{r-1} (r-1)x^{r-2} e^{-\lambda x}/(r-1)! + \lambda^{r-1} x^{r-1} \cdot \lambda e^{-\lambda x}/(r-1)!\\ & = \lambda^r x^{r-1} e^{-\lambda x}/(r-1)! \end{align*}

where you can replace \((r-1)! = \Gamma(r)\text{.}\)

Notice that for this random variable, \(\mu = \lambda T\) can be obtained for the exponential distribution. For the Gamma distribution, the following takes \(\mu\) to be the average interval till the first success and then modifies the corresponding Gamma parameters according to increasing values of r.

So, to summarize, you get the Gamma Probability Function below.

Definition 8.4.3. Gamma Probability Function.

If X measures the interval until the rth success and \(\mu\) as the average interval until the 1st success, then X with probability function

\begin{equation*} f(x) = \frac{x^{r-1} \cdot e^{-\frac{x}{\mu}}}{\Gamma(r) \cdot \mu^r} \end{equation*}

has a Gamma Distribution.

Checkpoint 8.4.4.
Example 8.4.5. Router Requests Revisited Again.

For the third time, let's consider a router which, over time, has been shown to receive on average 1000 requests in any given 10 minute period during regular working hours and you want to know the likelihood that it takes more than 4 seconds in order to receive the 5th request. As you have already seen, it takes on average \(\frac{10}{1000} = \frac{1}{100} = 0.01\) minutes to receive the first request so we use that again here. If X were to measure the time interval until the fifth actual request comes in, then the Gamma distribution would be a good model using

\begin{equation*} f(x) = \frac{x^{5-1} \cdot e^{- \frac{x}{0.01}}}{\Gamma(5) \cdot 0.01^5} \end{equation*}

The question above asks for

\begin{equation*} P(X \gt 4 \text{seconds}) = P(X \gt \frac{4}{60} ) = 1 - F(\frac{4}{60}). \end{equation*}

Therefore

\begin{equation*} P(X \gt 4 \text{seconds}) = 1 - F(\frac{4}{60}) \approx 0.205627. \end{equation*}

Again, since X is a continuous variable you must integrate to compute probabilities. This will require integration by parts or you can use the F(x) from the derivation above. Here, let's just let Sage do the integration for us noting that \(\Gamma(5) = 4! = 24\text{.}\) You can compute the needed integral using the interactive cell immediately below.

This is kind of a tough integral to do. Let's just evaluate the sage code below.

You can graph the gamma distribution's probability function for various parameters below. Notice as r increases the curve becomes increasingly bell-shaped whicle changing the mean only shifts the curve around.

Evaluate the interactive cell below to let Sage do the heavy lifting.

Derivation of mean, variance, skewness, and kurtosis. Pick "alpha" for the general formulas.

The interactive cell below can be used to compute the distribution function for the gamma distribution for various input values. If you desire to let r get bigger than the slider allows, feel free to edit the cell above and evaluate again.