5-5. Gamma Distribution (*)

伽马分布

The gamma distribution is another widely used distribution. Its importance is largely due to its relation to exponential and normal distributions. Here, we will provide an introduction to the gamma distribution.

The gamma distribution is a family of right-skewed, continuous probability distributions. These distributions are useful in real-life where something has a natural minimum of 0. For example, it is commonly used in finance, for elapsed times, or during Poisson processes.

1. Gamma Function

Before introducing the gamma random variable, we need to introduce the gamma function.

Gamma Function : Γ(α)0xα1exdx\Gamma (\alpha ) \equiv \int_{0}^{\infty }x^{\alpha -1}e^{-x}dx

==> Γ(α)=[yα1ey]0+(α1)0yα2eydy=(α1)Γ(α1).\Gamma (\alpha ) = \left [ -y^{\alpha -1} e^{-y} \right ]_{0}^{\infty } + (\alpha -1)\int_{0}^{\infty }y^{\alpha -2}e^{-y}dy=(\alpha -1)\Gamma (\alpha -1)^{} .

  • Γ(1)=0x11exdx=1.\Gamma (1) = \int_{0}^{\infty }x^{1 -1}e^{-x}dx= 1.

  • If α\alpha is an integer n,n, Γ(n)=(n1)Γ(n1)==(n1)(n2)×2×1=(n1)!\Gamma (n ) = (n -1)\Gamma (n -1) = \cdots = (n -1)(n-2)\cdots \times 2\times 1 = (n-1)!

The following figure shows the gamma function for positive real values.

1.1 Properties of the gamma function

For any positive real number αα :

  1. Γ(α)=0xα1exdx\Gamma(\alpha )= \int_{0}^{\infty } x^{_{\alpha -1}} e^{-x}dx

  2. 0xα1eλxdx=Γ(α)λα\int_{0}^{\infty } x^{_{\alpha -1}} e^{-\lambda x}dx = \frac{\Gamma(\alpha )} {\lambda^\alpha}, for λ>0;λ>0;

  3. Γ(α+1)=αΓ(α);Γ(α+1)=αΓ(α);

  4. Γ(n)=(n1)!Γ(n)=(n−1)! , for n=1,2,3,;n=1,2,3,⋯;

  5. Γ(12)=πΓ(\frac{1}{2})= \sqrt{π} .

EXAMPLE 26. Answer the following questions:

  1. Find Γ(72).Γ(\frac{7}{2}).

  2. Find the value of the following integral: I=0x6e5dx I = \int_{0}^{\infty } x^{6} e^{-5}dx

[ Solution ]

  1. Γ(72)Γ(\frac{7}{2}) =52×Γ(52)= \frac{5}{2} \times Γ(\frac{5}{2}) (using Property 3) =52×32×Γ(32)= \frac{5}{2} \times \frac{3}{2} \times Γ(\frac{3}{2}) (using Property 3) =52×32×12×Γ(12)= \frac{5}{2} \times \frac{3}{2} \times \frac{1}{2} \times Γ(\frac{1}{2}) (using Property 3) =52×32×12×π= \frac{5}{2} \times \frac{3}{2} \times \frac{1}{2} \times \sqrt {\pi} (using Property 5) =158×π= \frac{15}{8} \times \sqrt {\pi}

  2. (Using Property 2) with α=7α=7 and λ=5λ=5 , we obtain I=0x6e5dx=Γ(7)57=6!570.0092 I = \int_{0}^{\infty } x^{6} e^{-5}dx = \frac{\Gamma(7 )} {5^7} = \frac{6!} {5^7} \approx 0.0092

2. Gamma Distribution

In Γ(α)=0xα1exdx\Gamma(\alpha )= \int_{0}^{\infty } x^{_{\alpha -1}} e^{-x}dx ,

for random variable X=x,X=x,

Γ(α)=0xα1exdx\Gamma(\alpha )= \int_{0}^{\infty } x^{_{\alpha -1}} e^{-x}dx => 1=01Γ(α)xα1exdx1= \int_{0}^{\infty } \frac{1}{\Gamma(\alpha )} x^{_{\alpha -1}} e^{-x}dx

f(x)=1Γ(α)xα1ex\therefore f(x) = \frac{1}{\Gamma(\alpha )} x^{_{\alpha -1}} e^{-x} is the pdf of XGamma(α,1)X ∼ Gamma(\alpha, 1) .

Gamma Distribution

f(x)=1θαΓ(α)xα1ex/θ,f(x) = \frac{1}{\theta ^\alpha \Gamma (\alpha )}x^{\alpha -1}e^{-x / \theta}, x>0;x > 0; α,θ>0\alpha, \theta >0

where α\alpha is the shape parameter which forms the shape of the distribution, and θ\theta is the rate parameter (the reciprocal of the scale parameter λ\lambda ).

If α=1\alpha = 1, f(x)=1θΓ(1)x11ex/θ=(1θ)ex(1θ)f(x) = \frac{1}{\theta \Gamma (1)}x^{1 -1}e^{-x / \theta} = (\frac{1}{\theta})e^{-x (\frac{1}{\theta})} which is the exponential distribution with λ=1θ\lambda = \frac {1}{\theta}.

A continuous random variable X is said to have a gamma distribution with parameters α>0α>0 and λ>0λ>0 , shown as XGamma(α,λ)X∼Gamma(α,λ) , if its PDF is given by

fX(x)={λαxα1eλxΓ(α)x>00otherwisef_X(x) = \left\{ \begin{array}{l l} \frac{\lambda^{\alpha} x^{\alpha-1} e^{-\lambda x}}{\Gamma(\alpha)} \hspace {5pt} x > 0\\ 0 \hspace{56pt} \textrm{otherwise} \end{array}\right.

2.1 Relationship between Gamma Distribution and Exponential Distribution

If we let α=1α=1 , we obtain

fX(x)={λeλxx>00otherwisef_X(x) = \left\{ \begin{array}{l l} \lambda e^{-\lambda x} \hspace{20pt} x > 0\\ 0 \hspace{41pt} \textrm{otherwise} \end{array}\right.

Thus, we conclude Gamma(1,λ)=Exponential(λ)Gamma(1,λ)=Exponential(λ) .

More generally, if you sum nn identical independent Exponential(λλ) random variables, then you will get a Gamma(n,λ)Gamma(n,λ) random variable. (We will prove this later on using the moment generating function.)

IfX1,X2,,XnX_1, X_2, \cdots , X_n iid~\widetilde{iid} Exp(λ1/θ)Exp(\lambda \equiv 1/\theta ) , i=1nXiΓ(n,θ).\sum_{i=1}^{n}X_i \sim \Gamma (n, \theta ).

The gamma distribution is also related to the normal distribution as will be discussed later. Figure 4.10 shows the PDF of the gamma distribution for several values of αα .

EXAMPLE 27. Using the properties of the gamma function, show that the gamma PDF integrates to 1, i.e., show that for αα , λ>0λ>0 , we have

0λαxα1eλxΓ(α)dx=1.\int_0^\infty \frac{\lambda^{\alpha}x^{\alpha - 1} e^{-\lambda x}}{\Gamma(\alpha)} dx = 1.

[ Solution ]

감마분포를 간략히 표현하자면 αα 번째 사건이 일어날 때 까지 걸리는 시간에 대한 연속확률분포이다. 즉, 총 αα 번의 사건이 발생할 때까지 걸린 시간에 대한 확률분포를 보여준다.

여기서 θ\theta는 포아송 분포의 모수와 비슷한 역할을 합니다. (감마 분포에서는 αα , θ\theta 둘 다 모수(parameter)라고 부릅니다. 단지 이 둘의 역할이 다를 뿐이죠. αα 는 '형태 모수(shape parameter)', θ\theta는 '비율 모수(ratio parameter)'라고 한다.)

2.2 Expected Value and Variance

Expected Value and Variance of Gamma Distribution

XGamma(α,1θ)X \sim Gamma(\alpha, \frac{1}{ \theta } )

E(X)=αθ,E(X) = \alpha \theta, Var(X)=αθ2Var(X) = \alpha \theta^2 .

Or

XGamma(α,λ)X \sim Gamma(\alpha,\lambda) ;

E(X)=αλ,E(X) = \frac{\alpha}{ \lambda}, Var(X)=αλ2Var(X) =\frac{\alpha}{ \lambda ^2} .

EXAMPLE 28. θ=1\theta =1 일 때, α=0.5,1,2,3\alpha = 0.5, 1, 2, 3 인 감마분포의 확률밀도함수와 누적분포함수를 그래프로 작성하시오.

[ Solution ]

library(Rstat)

# set the parameter, run the function
alp <- c(0.5, 1:3); rate <- 1
cont.mpdf("gamma", 0,8, para=alp, para2=rate, ymax=1.2)

EXAMPLE 29. 어떤 전동안마기의 수명이 평균 10년, 분산 50인 감마분포를 따를 때, 다음을 구하시오.

  1. 이 전동안마가 3년간 고장 없이 작동할 확률

  2. 이 전동안마가 8년간 고장 없이 작동할 확률

  3. 5년간 고장이 없었을 때, 앞으로 3년 더 고장 없이 작동할 확률

[ Solution ]

E(X)=αθ=10,E(X) = \alpha \theta = 10, Var(X)=αθ2=50,Var(X) = \alpha \theta^2 = 50, ==> α=2,θ=5.\alpha =2, \theta = 5.

  1. P(X>3)=152Γ(2)3x21ex/5dx=1253xex/5dxP(X>3) = \frac{1}{5^2 \Gamma(2)}\int_{3}^{\infty }x^{2-1}e^{-x/5}dx = \frac{1}{25}\int_{3}^{\infty }xe^{-x/5}dx =125{[5xex/5]38+35ex/5dx}= \frac{1}{25} \{ \left [ -5xe^{-x/5} \right ]_{3}^{8 } + \int_{3}^{\infty }5e^{-x/5}dx \} =125{15e3/5+[25ex/5]3}=(35+1)e350.8781= \frac{1}{25} \{ 15e^{-3/5} + \left [ -25e^{-x/5} \right ]_{3}^{ \infty} \} = (\frac{3}{5} + 1) e^{-\frac{3}{5}} \approx 0.8781

  2. P(X>8)=(85+1)e850.5249P(X>8) = (\frac{8}{5} + 1) e^{-\frac{8}{5}} \approx 0.5249

  3. P(X>5+3X>5)=P(X>8)P(X>5).P(X>5+3 | X>5) = \frac{P(X>8)}{P(X>5)}. P(X>5)=(55+1)e550.7358P(X>5) = (\frac{5}{5} + 1) e^{-\frac{5}{5}} \approx 0.7358 P(X>5+3X>5)=0.52490.73580.7134.P(X>5+3 | X>5) = \frac{0.5249}{0.7358} \approx 0.7134.

library(Rstat)

EX <- 10; VX <- 50
alp <- EX^2/VX ; th <- EX / alp

# 1. P(X>3)
pgamma(3, apl, 1/th, lower=FALSE)

# 2. P(X>8)
pgamma(8, apl, 1/th, lower=FALSE)

# 3. P(X>5+3 | X>5) = P(X>8) / P(X>5)
pgamma(8, apl, 1/th, lower=FALSE) / pgamma(5, apl, 1/th, lower=FALSE)

Last updated