NAG FL Interface
g01eef (prob_​beta)

Settings help

FL Name Style:


FL Specification Language:


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

Fortran Interface
Subroutine g01eef ( x, a, b, tol, p, q, pdf, ifail)
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: x, a, b, tol
Real (Kind=nag_wp), Intent (Out) :: p, q, pdf
C Header Interface
#include <nag.h>
void  g01eef_ (const double *x, const double *a, const double *b, const double *tol, double *p, double *q, double *pdf, Integer *ifail)
The routine may be called by the names g01eef or nagf_stat_prob_beta.

3 Description

The probability density function of the beta distribution with parameters a and b is:
f(B:a,b)=Γ(a+b) Γ(a)Γ(b) Ba-1(1-B)b-1,  0B1;a,b>0.  
The lower tail probability, P(Bβ:a,b) is defined by
P(Bβ:a,b)=Γ(a+b) Γ(a)Γ(b) 0βBa-1(1-B)b-1dB=Iβ(a,b),  0β1;a,b>0.  
The function Ix(a,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 Arguments

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 argument is no longer referenced, but is included for backwards compatability.
5: p Real (Kind=nag_wp) Output
On exit: the lower tail probability, P(Bβ:a,b).
6: q Real (Kind=nag_wp) Output
On exit: the upper tail probability, P(Bβ:a,b).
7: pdf Real (Kind=nag_wp) Output
On exit: the probability density function, f(B:a,b).
8: 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 g01eef may return useful information.
ifail=1
On entry, x=value.
Constraint: x1.0.
On entry, x=value.
Constraint: x0.0.
ifail=2
On entry, a=value and b=value.
Constraint: a>0.0.
On entry, a=value and b=value.
Constraint: b>0.0.
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

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

8 Parallelism and Performance

g01eef is not threaded in any implementation.

9 Further Comments

None.

10 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.

10.1 Program Text

Program Text (g01eefe.f90)

10.2 Program Data

Program Data (g01eefe.d)

10.3 Program Results

Program Results (g01eefe.r)