NAG Library Routine Document

g01gef (prob_beta_noncentral)

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 <nagmk26.h>
double  g01gef_ (const double *x, const double *a, const double *b, const double *rlamda, const double *tol, const Integer *maxit, Integer *ifail)

3
Description

The lower tail probability for the noncentral beta distribution with parameters a and b and noncentrality parameter λ, PBβ:a,b;λ, is defined by
PBβ:a,b;λ=j=0e-λ/2 λ/2 j! PBβ:a,b;0, (1)
where
PBβ : a,b;0=Γ a+b Γ aΓ b 0βBa- 11-Bb- 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 PBβ: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 PBβ: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.0logU, 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 – IntegerInput
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 – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, because for this routine the values of the output arguments may be useful even if ifail0 on exit, the recommended value is -1. 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).
Note: g01gef may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
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.0logU, 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 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Convergence is theoretically guaranteed whenever PY>maxittol 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

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)