NAG Library Routine Document
G01FEF returns the deviate associated with the given lower tail probability of the beta distribution, via the routine name.
|REAL (KIND=nag_wp) G01FEF
||P, A, B, TOL
, associated with the lower tail probability,
, of the beta distribution with parameters
is defined as the solution to
The algorithm is a modified version of the Newton–Raphson method, following closely that of Cran et al. (1977)
An initial approximation,
is found (see Cran et al. (1977)
), and the Newton–Raphson iteration
is used, with modifications to ensure that
remains in the range
Cran G W, Martin K J and Thomas G E (1977) Algorithm AS 109. Inverse of the incomplete beta function ratio Appl. Statist. 26 111–114
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
- 1: P – REAL (KIND=nag_wp)Input
On entry: , the lower tail probability from the required beta distribution.
- 2: A – REAL (KIND=nag_wp)Input
On entry: , the first parameter of the required beta distribution.
- 3: B – REAL (KIND=nag_wp)Input
On entry: , the second parameter of the required beta distribution.
- 4: TOL – REAL (KIND=nag_wp)Input
: the relative accuracy required by you in the result. If G01FEF is entered with TOL
greater than or equal to
or less than
), then the value of
is used instead.
- 5: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
on exit, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Note: G01FEF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
If on exit or , then G01FEF returns .
There is doubt concerning the accuracy of the computed result.
iterations of the Newton–Raphson method have been performed without satisfying the accuracy criterion (see Section 7
). The result should be a reasonable approximation of the solution.
Requested accuracy not achieved when calculating beta probability. The result should be a reasonable approximation to the correct solution. You should try setting TOL
The required precision, given by TOL
, should be achieved in most circumstances.
The typical timing will be several times that of G01EEF
and will be very dependent on the input parameter values. See G01EEF
for further comments on timings.
This example reads lower tail probabilities for several beta distributions and calculates and prints the corresponding deviates until the end of data is reached.
9.1 Program Text
Program Text (g01fefe.f90)
9.2 Program Data
Program Data (g01fefe.d)
9.3 Program Results
Program Results (g01fefe.r)