NAG CL Interface
g01eec (prob_​beta)

Settings help

CL Name Style:


1 Purpose

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

2 Specification

#include <nag.h>
void  g01eec (double x, double a, double b, double tol, double *p, double *q, double *pdf, NagError *fail)
The function may be called by the names: g01eec, nag_stat_prob_beta or nag_prob_beta_dist.

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

4 References

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

5 Arguments

1: x double Input
On entry: β, the value of the beta variate.
Constraint: 0.0x1.0.
2: a double Input
On entry: a, the first parameter of the required beta distribution.
Constraint: 0.0<a106.
3: b double Input
On entry: b, the second parameter of the required beta distribution.
Constraint: 0.0<b106.
4: tol double Input
On entry: this argument is no longer referenced, but is included for backwards compatability.
5: p double * Output
On exit: the lower tail probability, P(Bβ:a,b).
6: q double * Output
On exit: the upper tail probability, P(Bβ:a,b).
7: pdf double * Output
On exit: the probability density function, f(B:a,b).
8: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REAL_ARG_GT
On entry, x=value.
Constraint: x1.0.
NE_REAL_ARG_LE
On entry, a=value and b=value.
Constraint: a>0.0.
On entry, a=value and b=value.
Constraint: b>0.0.
NE_REAL_ARG_LT
On entry, x=value.
Constraint: x0.0.

7 Accuracy

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

8 Parallelism and Performance

g01eec 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 (g01eece.c)

10.2 Program Data

Program Data (g01eece.d)

10.3 Program Results

Program Results (g01eece.r)