hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_prob_beta (g01ee)

Purpose

nag_stat_prob_beta (g01ee) computes the upper and lower tail probabilities and the probability density function of the beta distribution with parameters aa and bb.

Syntax

[p, q, pdf, ifail] = g01ee(x, a, b)
[p, q, pdf, ifail] = nag_stat_prob_beta(x, a, b)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 23: tol dropped from interface
.

Description

The probability density function of the beta distribution with parameters aa and bb is:
f(B : a,b) = (Γ(a + b))/(Γ(a)Γ(b))Ba1(1B)b1,  0B1;a,b > 0.
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)P(Bβ:a,b) is defined by
β
P(Bβ : a,b) = (Γ(a + b))/(Γ(a)Γ(b))Ba1(1B)b1dB = Iβ(a,b),  0β1;a,b > 0.
0
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)Ix(a,b), also known as the incomplete beta function is calculated using nag_specfun_beta_incomplete (s14cc).

References

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

Parameters

Compulsory Input Parameters

1:     x – double scalar
ββ, the value of the beta variate.
Constraint: 0.0x1.00.0x1.0.
2:     a – double scalar
aa, the first parameter of the required beta distribution.
Constraint: 0.0 < a1060.0<a106.
3:     b – double scalar
bb, the second parameter of the required beta distribution.
Constraint: 0.0 < b1060.0<b106.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

tol

Output Parameters

1:     p – double scalar
The lower tail probability, P(Bβ : a,b)P(Bβ:a,b).
2:     q – double scalar
The upper tail probability, P(Bβ : a,b)P(Bβ:a,b).
3:     pdf – double scalar
The probability density function, f(B : a,b)f(B:a,b).
4:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Note: nag_stat_prob_beta (g01ee) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,x < 0.0x<0.0,
orx > 1.0x>1.0.
  ifail = 2ifail=2
On entry,a0.0a0.0,
ora > 106a>106,
orb0.0b0.0,
orb > 106b>106.
W ifail = 4ifail=4
x is too far out into the tails for the probability to be evaluated exactly. The results returned are 00 and 11 as appropriate. These should be a good approximation to the required solution.

Accuracy

The accuracy is limited by the error in the incomplete beta function. See Section [Accuracy] in (s14cc) for further details.

Further Comments

None.

Example

function nag_stat_prob_beta_example
x = 0.25;
a = 1;
b = 2;
[p, q, pdf, ifail] = nag_stat_prob_beta(x, a, b)
 

p =

    0.4375


q =

    0.5625


pdf =

    1.5000


ifail =

                    0


function g01ee_example
x = 0.25;
a = 1;
b = 2;
[p, q, pdf, ifail] = g01ee(x, a, b)
 

p =

    0.4375


q =

    0.5625


pdf =

    1.5000


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013