20.4.11 Gamma distribution
The probability density function for the gamma distribution.
The gamma distribution depends on two parameters, a>0 and b>0; the
value of the density function at x ≥ 0 is
gammad(a,b,x)=xa−1e−bxba/Γ(a)
(8) |
The gammad
command computes this density function.
-
gammad takes three arguments:
-
a and b, positive real numbers (the parameters).
- x, a real number.
- gammad(a,b,x) returns the value of the gamma
density function with parameters a and b, given in
(8).
Example
The cumulative distribution function for the gamma distribution.
The gamma_cdf
command computes the cumulative distribution function for the gamma distribution.
-
gamma_cdf takes three mandatory arguments and one
optional argument:
-
a and b, real numbers (the parameters).
- x, a real number.
- Optionally, y, a real number.
- gamma_cdf(a,b,x) returns
Prob(X ≤ x) for the gamma distribution with parameters
a and b.
- gamma_cdf(n,x,y) returns
Prob(x ≤ X ≤ y).
It turns out that
gammad_cdf(n,x)=igamma(a, bx, 1),
|
where igamma is the incomplete gamma function
(see Section 7.3.15),
igamma(a,x,1)= | | ∫ | | e−tta−1dt.
|
Examples
The inverse distribution function for the gamma distribution.
The gammad_icdf
command computes the inverse distribution for the gamma distribution.
-
gamma_icdf takes three arguments:
-
a and b, numbers (the parameters).
- h, a real number between 0 and 1.
- gamma_icdf(a,b,h) returns the inverse
distribution for the gamma distribution with parameters a and b;
namely, the value of x for which Prob(X ≤ x)=h.
Example