nag_prob_beta_dist (g01eec) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_prob_beta_dist (g01eec)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_prob_beta_dist (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>
#include <nagg01.h>
void  nag_prob_beta_dist (double x, double a, double b, double tol, double *p, double *q, double *pdf, NagError *fail)

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 nag_incomplete_beta (s14ccc).

4  References

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

5  Arguments

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

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction 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.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction 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 nag_incomplete_beta (s14ccc) for further details.

8  Parallelism and Performance

Not applicable.

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)


nag_prob_beta_dist (g01eec) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

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