9.4.11 The gamma distribution
The probability density function for the gamma distribution: gammad
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.
Input:
gammad(2,1,3)
Output:
The cumulative distribution function for the gamma distribution: gammad_cdf
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 6.8.15),
igamma(a,x,1) = | ∫ | | e−tta−1dt/Γ(a).
|
Examples.
-
Input:
gammad_cdf(2,1,0.5)
Output:
- Input:
gammad_cdf(2,1,0.5,1.5)
Output:
The inverse distribution function for the gamma distribution: gammad_icdf
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.
Input:
gammad_icdf(2,1,0.5)
Output: