nag_deviates_gamma_dist (g01ffc) returns the deviate associated with the given lower tail probability of the gamma distribution.
The deviate,
, associated with the lower tail probability,
, of the gamma distribution with shape parameter
and scale parameter
, is defined as the solution to
The method used is described by
Best and Roberts (1975) making use of the relationship between the gamma distribution and the
-distribution.
Let
. The required
is found from the Taylor series expansion
where
is a starting approximation
- ,
- ,
- ,
- ,
- .
For most values of
and
the starting value
is used, where
is the deviate associated with a lower tail probability of
for the standard Normal distribution.
For large
values, when
,
is found to be a better starting value than
.
Seven terms of the Taylor series are used to refine the starting approximation, repeating the process if necessary until the required accuracy is obtained.
Best D J and Roberts D E (1975) Algorithm AS 91. The percentage points of the distribution Appl. Statist. 24 385–388
In most cases the relative accuracy of the results should be as specified by
tol. However, for very small values of
or very small values of
there may be some loss of accuracy.
Not applicable.
None.
This example reads lower tail probabilities for several gamma distributions, and calculates and prints the corresponding deviates until the end of data is reached.