NAG FL Interface
g01gef (prob_​beta_​noncentral)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

g01gef returns the probability associated with the lower tail of the noncentral beta distribution.

2 Specification

Fortran Interface
Function g01gef ( x, a, b, rlamda, tol, maxit, ifail)
Real (Kind=nag_wp) :: g01gef
Integer, Intent (In) :: maxit
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: x, a, b, rlamda, tol
C Header Interface
#include <nag.h>
double  g01gef_ (const double *x, const double *a, const double *b, const double *rlamda, const double *tol, const Integer *maxit, Integer *ifail)
The routine may be called by the names g01gef or nagf_stat_prob_beta_noncentral.

3 Description

The lower tail probability for the noncentral beta distribution with parameters a and b and noncentrality parameter λ, P(Bβ:a,b;λ), is defined by
P(Bβ:a,b;λ)=j=0e-λ/2 (λ/2) j! P(Bβ:a,b;0), (1)
where
P(Bβ : a,b;0)=Γ (a+b) Γ (a)Γ (b) 0βBa- 1(1-B)b- 1dB,  
which is the central beta probability function or incomplete beta function.
Recurrence relationships given in Abramowitz and Stegun (1972) are used to compute the values of P(Bβ:a,b;0) for each step of the summation (1).
The algorithm is discussed in Lenth (1987).

4 References

Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Lenth R V (1987) Algorithm AS 226: Computing noncentral beta probabilities Appl. Statist. 36 241–244

5 Arguments

1: x Real (Kind=nag_wp) Input
On entry: β, the deviate from the beta distribution, for which the probability P(Bβ:a,b;λ) is to be found.
Constraint: 0.0x1.0.
2: a Real (Kind=nag_wp) Input
On entry: a, the first parameter of the required beta distribution.
Constraint: 0.0<a106.
3: b Real (Kind=nag_wp) Input
On entry: b, the second parameter of the required beta distribution.
Constraint: 0.0<b106.
4: rlamda Real (Kind=nag_wp) Input
On entry: λ, the noncentrality parameter of the required beta distribution.
Constraint: 0.0rlamda-2.0log(U), where U is the safe range parameter as defined by x02amf.
5: tol Real (Kind=nag_wp) Input
On entry: the relative accuracy required by you in the results. If g01gef is entered with tol greater than or equal to 1.0 or less than 10×machine precision (see x02ajf), the value of 10×machine precision is used instead.
See Section 7 for the relationship between tol and maxit.
6: maxit Integer Input
On entry: the maximum number of iterations that the algorithm should use.
See Section 7 for suggestions as to suitable values for maxit for different values of the arguments.
Suggested value: 500.
Constraint: maxit1.
7: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value −1 is recommended since useful values can be provided in some output arguments even when ifail0 on exit. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases g01gef may return useful information.
ifail=1
On entry, a=value.
Constraint: 0.0<a106.
On entry, b=value.
Constraint: 0.0<b106.
On entry, maxit=value.
Constraint: maxit1.
On entry, rlamda=value.
Constraint: 0.0rlamda-2.0log(U), where U is the safe range parameter as defined by x02amf.
On entry, x=value.
Constraint: 0.0x1.0.
ifail=2
The solution has failed to converge in value iterations. Consider increasing maxit or tol. The returned value will be an approximation to the correct value.
ifail=3
The probability is too close to 0.0 or 1.0 for the algorithm to be able to calculate the required probability. g01gef will return 0.0 or 1.0 as appropriate. This should be a reasonable approximation.
ifail=4
The required accuracy was not achieved when calculating the initial value of the beta distribution. You should try a larger value of tol. The returned value will be an approximation to the correct value. This error exit is no longer possible but is still documented for historical reasons.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Convergence is theoretically guaranteed whenever P(Y>maxit)tol where Y has a Poisson distribution with mean λ/2. Excessive round-off errors are possible when the number of iterations used is high and tol is close to machine precision. See Lenth (1987) for further comments on the error bound.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g01gef is not threaded in any implementation.

9 Further Comments

The central beta probabilities can be obtained by setting rlamda=0.0.

10 Example

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

10.1 Program Text

Program Text (g01gefe.f90)

10.2 Program Data

Program Data (g01gefe.d)

10.3 Program Results

Program Results (g01gefe.r)