g01fe returns the deviate associated with the given lower tail probability of the beta distribution.

Syntax

C#
```public static double g01fe(
double p,
double a,
double b,
double tol,
out int ifail
)```
Visual Basic
```Public Shared Function g01fe ( _
p As Double, _
a As Double, _
b As Double, _
tol As Double, _
<OutAttribute> ByRef ifail As Integer _
) As Double```
Visual C++
```public:
static double g01fe(
double p,
double a,
double b,
double tol,
[OutAttribute] int% ifail
)```
F#
```static member g01fe :
p : float *
a : float *
b : float *
tol : float *
ifail : int byref -> float
```

Parameters

p
Type: System..::..Double
On entry: $p$, the lower tail probability from the required beta distribution.
Constraint: $0.0\le {\mathbf{p}}\le 1.0$.
a
Type: System..::..Double
On entry: $a$, the first parameter of the required beta distribution.
Constraint: $0.0<{\mathbf{a}}\le {10}^{6}$.
b
Type: System..::..Double
On entry: $b$, the second parameter of the required beta distribution.
Constraint: $0.0<{\mathbf{b}}\le {10}^{6}$.
tol
Type: System..::..Double
On entry: the relative accuracy required by you in the result. If g01fe is entered with tol greater than or equal to $1.0$ or less than  (see x02aj), then the value of  is used instead.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Return Value

g01fe returns the deviate associated with the given lower tail probability of the beta distribution.

Description

The deviate, ${\beta }_{p}$, associated with the lower tail probability, $p$, of the beta distribution with parameters $a$ and $b$ is defined as the solution to
 $PB≤βp:a,b=p=Γa+bΓaΓb∫0βpBa-11-Bb-1dB, 0≤βp≤1;a,b>0.$
The algorithm is a modified version of the Newton–Raphson method, following closely that of Cran et al. (1977).
An initial approximation, ${\beta }_{0}$, to ${\beta }_{p}$ is found (see Cran et al. (1977)), and the Newton–Raphson iteration
 $βi=βi-1-fβi-1f′βi-1,$
where $f\left(\beta \right)=P\left(B\le \beta :a,b\right)-p$ is used, with modifications to ensure that $\beta$ remains in the range $\left(0,1\right)$.

References

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

Error Indicators and Warnings

Note: g01fe may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
If on exit ${\mathbf{ifail}}={1}$ or ${2}$, then g01fe returns $0.0$.
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{p}}<0.0$, or ${\mathbf{p}}>1.0$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{a}}\le 0.0$, or ${\mathbf{a}}>{10}^{6}$, or ${\mathbf{b}}\le 0.0$, or ${\mathbf{b}}>{10}^{6}$.
${\mathbf{ifail}}=3$
There is doubt concerning the accuracy of the computed result. $100$ iterations of the Newton–Raphson method have been performed without satisfying the accuracy criterion (see [Accuracy]). The result should be a reasonable approximation of the solution.
${\mathbf{ifail}}=4$
Requested accuracy not achieved when calculating beta probability. The result should be a reasonable approximation to the correct solution. You should try setting tol larger.
${\mathbf{ifail}}=-9000$
An error occured, see message report.

Accuracy

The required precision, given by tol, should be achieved in most circumstances.

Parallelism and Performance

None.

The typical timing will be several times that of g01ee and will be very dependent on the input parameter values. See g01ee for further comments on timings.

Example

This example reads lower tail probabilities for several beta distributions and calculates and prints the corresponding deviates until the end of data is reached.

Example program (C#): g01fee.cs

Example program data: g01fee.d

Example program results: g01fee.r