# AP Statistics Curriculum 2007 Gamma

(Difference between revisions)
 Revision as of 17:49, 11 July 2011 (view source)TracyTam (Talk | contribs) (Created page with '=== Gamma Distribution === Definition: '''Gamma distribution''' is a distribution that arises naturally in processes for which the waiting times between events are relevant. It c…')← Older edit Revision as of 18:23, 11 July 2011 (view source)TracyTam (Talk | contribs) (→Gamma Distribution)Newer edit → Line 1: Line 1: === Gamma Distribution === === Gamma Distribution === - Definition: '''Gamma distribution''' is a distribution that arises naturally in processes for which the waiting times between events are relevant. It can be thought of as a waiting time between Poisson distributed events. + '''Definition''': Gamma distribution is a distribution that arises naturally in processes for which the waiting times between events are relevant. It can be thought of as a waiting time between Poisson distributed events. - Probability density function: The waiting time until the hth Poisson event with a rate of change $\lambda$ is +
'''Probability density function''': The waiting time until the hth Poisson event with a rate of change $\lambda$ is - \begin{center} $P(x)=\frac{\lambda(\lambda x)^{h-1}}{(h-1)!}{e^{-\lambda x}}$ end{center} + :$P(x)=\frac{\lambda(\lambda x)^{h-1}}{(h-1)!}{e^{-\lambda x}}$ - For '''X~Gamma(k,$\theta$)''', where $k=h$ and $\theta=1/\lambda$, the gamma probability density function is given by - $\frac{x^{k-1}e^{-x/\theta}}{\Gamma(k)\theta^k}$ + For X~Gamma(k,$\theta$), where $k=h and [itex]\theta=1/\lambda$, the gamma probability density function is given by + :$\frac{x^{k-1}e^{-x/\theta}}{\Gamma(k)\theta^k}$ + where + *e is the natural number (e = 2.71828…) + *k is the number of occurrences of an event + *if k is a positive integer, then $\Gamma(k)=(k-1)!$ is the gamma function + *$\theta=1/\lambda$ is the mean number of events per time unit, where $\lambda$ is the mean time between events. For example, if the mean time between phone calls is 2 hours, then you would use a gamma distribution with $\theta$=1/2=0.5. If we want to find the mean number of calls in 5 hours, it would be 5 $\times$ 1/2=2.5. + *x is a random variable +
'''Cumulative density function''': The gamma cumulative distribution function is given by + :$\frac{\gamma(k,x/\theta)}{\Gamma(k)}$ - For '''X~Poisson(λ)''', the Poisson mass function is given by $P(X=k)=\frac{\lambda^k e^{-\lambda}}{k!},\,\!$ where + where - ** ''e'' is the [http://en.wikipedia.org/wiki/E_%28mathematical_constant%29 natural number] (''e'' = 2.71828...) + *if k is a positive integer, then $\Gamma(k)=(k-1)!$ is the gamma function - ** ''k'' is the number of occurrences of an event - the probability of which is given by the mass function + *$\gamma(k,x/\theta)=\int_0^{x/\theta}t^{k-1}e^{-t}dt$ - ** $k! = 1\times 2\times 3\times \cdots \times k$ + - ** λ is a positive real number, equal to the ''expected number of occurrences'' that occur during the given interval. For instance, if the events occur on average every 4 minutes, and you are interested in the number of events occurring in a 10 minute interval, you would use as model a Poisson distribution with λ=10/4=2.5. +
'''Moment generating function''': The gamma moment-generating function is + :$M(t)=(1-\theta t)^{-k}\!$ + +
'''Expectation''': The expected value of a gamma distributed random variable x is + :$E(X)=k\theta\! + + '''Variance''': The gamma variance is + :[itex]Var(X)=k\theta^2\!$ + + + ===Applications=== + The gamma distribution can be used a range of disciplines including queuing models, climatology, and financial services. Examples of events that may be modeled by gamma distribution include: + *The amount of rainfall accumulated in a reservoir + *The size of loan defaults or aggregate insurance claims + *The flow of items through manufacturing and distribution processes + *The load on web servers + *The many and varied forms of telecom exchange + + The gamma distribution is also used to model errors in a multi-level Poisson regression model because the combination of a Poisson distribution and a gamma distribution is a negative binomial distribution. + + + ===Example=== + Suppose you are fishing and you expect to get a fish once every 1/2 hour. Compute the probability that you will have to wait between 2 to 4 hours before you catch 4 fish. + + One fish every 1/2 hour means we would expect to get $\theta=1/0.5=2$ fish every hour on average. Using $\theta=2$ and $k=4$, we can compute this as follows: + :$P(2\le X\le 4)=\sum_{x=2}^4\frac{x^{4-1}e^{-x/2}}{\Gamma(4)2^4}=0.12388$ + + The figure below shows this result using [http://socr.ucla.edu/htmls/dist/Gamma_Distribution.html SOCR distributions]

## Revision as of 18:23, 11 July 2011

### Gamma Distribution

Definition: Gamma distribution is a distribution that arises naturally in processes for which the waiting times between events are relevant. It can be thought of as a waiting time between Poisson distributed events.

Probability density function: The waiting time until the hth Poisson event with a rate of change λ is

$P(x)=\frac{\lambda(\lambda x)^{h-1}}{(h-1)!}{e^{-\lambda x}}$

For X~Gamma(k,θ), where k = h and θ = 1 / λ, the gamma probability density function is given by

$\frac{x^{k-1}e^{-x/\theta}}{\Gamma(k)\theta^k}$

where

• e is the natural number (e = 2.71828…)
• k is the number of occurrences of an event
• if k is a positive integer, then Γ(k) = (k − 1)! is the gamma function
• θ = 1 / λ is the mean number of events per time unit, where λ is the mean time between events. For example, if the mean time between phone calls is 2 hours, then you would use a gamma distribution with θ=1/2=0.5. If we want to find the mean number of calls in 5 hours, it would be 5 $\times$ 1/2=2.5.
• x is a random variable

Cumulative density function: The gamma cumulative distribution function is given by

$\frac{\gamma(k,x/\theta)}{\Gamma(k)}$

where

• if k is a positive integer, then Γ(k) = (k − 1)! is the gamma function
• $\gamma(k,x/\theta)=\int_0^{x/\theta}t^{k-1}e^{-t}dt$

Moment generating function: The gamma moment-generating function is

$M(t)=(1-\theta t)^{-k}\!$

Expectation: The expected value of a gamma distributed random variable x is

$E(X)=k\theta\!$

Variance: The gamma variance is

$Var(X)=k\theta^2\!$

### Applications

The gamma distribution can be used a range of disciplines including queuing models, climatology, and financial services. Examples of events that may be modeled by gamma distribution include:

• The amount of rainfall accumulated in a reservoir
• The size of loan defaults or aggregate insurance claims
• The flow of items through manufacturing and distribution processes
• The load on web servers
• The many and varied forms of telecom exchange

The gamma distribution is also used to model errors in a multi-level Poisson regression model because the combination of a Poisson distribution and a gamma distribution is a negative binomial distribution.

### Example

Suppose you are fishing and you expect to get a fish once every 1/2 hour. Compute the probability that you will have to wait between 2 to 4 hours before you catch 4 fish.

One fish every 1/2 hour means we would expect to get θ = 1 / 0.5 = 2 fish every hour on average. Using θ = 2 and k = 4, we can compute this as follows:

$P(2\le X\le 4)=\sum_{x=2}^4\frac{x^{4-1}e^{-x/2}}{\Gamma(4)2^4}=0.12388$

The figure below shows this result using SOCR distributions