6.8 Gamma and incomplete gamma function

Gamma function

\[ \Gamma(x) = \int_{0}^{\infty} t^{x-1} e^{-t} dt \text{ for } 0 < x < \infty \]

Exercise

Using the definition prove the followings;

\[ \Gamma(1) = 1 \] \[ \Gamma(x + 1) = x \Gamma(x) \]

Gamma function is very essential in statistics, because it is used for the calculation of the nearly all distribution functions.

Log gamma function is more frequently used, because the result of the gamma function can be very large.

Incomplete gamma function

\[ P(a,x) = \frac{1}{\Gamma(a)} \int_0^x e^{-t} t^{a-1} dt \; (a > 0) \]

\[ P(a, 0) = 0, \; P(a, \infty) = 1 \]

\[ Q(a, x) = 1 - P(a, x) = \frac{1}{\Gamma(a)} \int_x^{\infty} e^{-t} t^{a-1} dt \; (a > 0) \]

gammp
## function (a, x) 
## {
##     if (x < 0 | a <= 0) {
##         warning("bad args in gammp")
##         return(NULL)
##     }
##     if (x == 0) 
##         return(0)
##     ASWITCH = 100
##     if (a >= ASWITCH) 
##         return(gammpapprox(a, x, 1))
##     if (x < a + 1) 
##         return(gser(a, x))
##     return(1 - gcf(a, x))
## }
## <bytecode: 0x000001e2ab992ac8>
## <environment: namespace:math>