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

NAG Library Routine Document

G01EEF

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

G01EEF computes the upper and lower tail probabilities and the probability density function of the beta distribution with parameters a and b.

2  Specification

SUBROUTINE G01EEF ( X, A, B, TOL, P, Q, PDF, IFAIL)
INTEGER  IFAIL
REAL (KIND=nag_wp)  X, A, B, TOL, P, Q, PDF

3  Description

The probability density function of the beta distribution with parameters a and b is:
fB:a,b=Γa+b ΓaΓb Ba-11-Bb-1,  0B1;a,b>0.
The lower tail probability, PBβ:a,b is defined by
PBβ:a,b=Γa+b ΓaΓb 0βBa-11-Bb-1dB=Iβa,b,  0β1;a,b>0.
The function Ixa,b, also known as the incomplete beta function is calculated using S14CCF.

4  References

Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth

5  Parameters

1:     X – REAL (KIND=nag_wp)Input
On entry: β, the value of the beta variate.
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:     TOL – REAL (KIND=nag_wp)Input
On entry: this parameter is no longer referenced, but is included for backwards compatability.
5:     P – REAL (KIND=nag_wp)Output
On exit: the lower tail probability, PBβ:a,b.
6:     Q – REAL (KIND=nag_wp)Output
On exit: the upper tail probability, PBβ:a,b.
7:     PDF – REAL (KIND=nag_wp)Output
On exit: the probability density function, fB:a,b.
8:     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: G01EEF 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,X<0.0,
orX>1.0.
IFAIL=2
On entry,A0.0,
orA>106,
orB0.0,
orB>106.
IFAIL=4
X is too far out into the tails for the probability to be evaluated exactly. The results returned are 0 and 1 as appropriate. These should be a good approximation to the required solution.

7  Accuracy

The accuracy is limited by the error in the incomplete beta function. See Section 7 in S14CCF for further details.

8  Further Comments

None.

9  Example

This example reads values from a number of beta distributions and computes the associated upper and lower tail probabilities and the corresponding value of the probability density function.

9.1  Program Text

Program Text (g01eefe.f90)

9.2  Program Data

Program Data (g01eefe.d)

9.3  Program Results

Program Results (g01eefe.r)


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

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