G01GEF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G01GEF returns the probability associated with the lower tail of the noncentral beta distribution, via the routine name.

2  Specification

REAL (KIND=nag_wp) G01GEF
REAL (KIND=nag_wp)  X, A, B, RLAMDA, TOL

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)
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  Parameters

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), then 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 parameters.
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 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 -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 parameters 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:
On entry,A0.0,
orRLAMDA>-2.0logU, where U= safe range parameter as defined by X02AMF,
If on exit IFAIL=1 then G01GEF returns zero.
The solution has failed to converge in MAXIT iterations. You should try a larger value of MAXIT or TOL. The returned value will be an approximation to the correct value.
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.
The required accuracy was not achieved when calculating the initial value of PBβ:a,b;λ. You should try a larger value of TOL. The returned value will be an approximation to the correct value.

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  Further Comments

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

9  Example

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

9.1  Program Text

Program Text (g01gefe.f90)

9.2  Program Data

Program Data (g01gefe.d)

9.3  Program Results

Program Results (g01gefe.r)

G01GEF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012