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_noncentral (g01ge)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_stat_prob_beta_noncentral (g01ge) returns the probability associated with the lower tail of the noncentral beta distribution.


[result, ifail] = g01ge(x, a, b, rlamda, 'tol', tol, 'maxit', maxit)
[result, ifail] = nag_stat_prob_beta_noncentral(x, a, b, rlamda, 'tol', tol, 'maxit', maxit)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: tol was made optional (default 0)


The lower tail probability for the noncentral beta distribution with parameters a and b and noncentrality parameter λ, PBβ:a,b;λ, is defined by
PBβ:a,b;λ=j=0e-λ/2 λ/2 j! PBβ:a,b;0, (1)
PBβ : a,b;0=Γ a+b Γ aΓ b 0βBa- 11-Bb- 1dB,  
which is the central beta probability function or incomplete beta function.
Recurrence relationships given in Abramowitz and Stegun (1972) are used to compute the values of PBβ:a,b;0 for each step of the summation (1).
The algorithm is discussed in Lenth (1987).


Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Lenth R V (1987) Algorithm AS 226: Computing noncentral beta probabilities Appl. Statist. 36 241–244


Compulsory Input Parameters

1:     x – double scalar
β, the deviate from the beta distribution, for which the probability PBβ:a,b;λ is to be found.
Constraint: 0.0x1.0.
2:     a – double scalar
a, the first parameter of the required beta distribution.
Constraint: 0.0<a106.
3:     b – double scalar
b, the second parameter of the required beta distribution.
Constraint: 0.0<b106.
4:     rlamda – double scalar
λ, the noncentrality parameter of the required beta distribution.
Constraint: 0.0rlamda-2.0logU, where U is the safe range parameter as defined by nag_machine_real_safe (x02am).

Optional Input Parameters

1:     tol – double scalar
Default: 0.0
The relative accuracy required by you in the results. If nag_stat_prob_beta_noncentral (g01ge) is entered with tol greater than or equal to 1.0 or less than 10×machine precision (see nag_machine_precision (x02aj)), then the value of 10×machine precision is used instead.
See Accuracy for the relationship between tol and maxit.
2:     maxit int64int32nag_int scalar
Default: 500.
The maximum number of iterations that the algorithm should use.
See Accuracy for suggestions as to suitable values for maxit for different values of the arguments.
Constraint: maxit1.

Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Note: nag_stat_prob_beta_noncentral (g01ge) 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.

On entry,a0.0,
orrlamda>-2.0logU, where U= safe range argument as defined by nag_machine_real_safe (x02am),
If on exit ifail=1 then nag_stat_prob_beta_noncentral (g01ge) returns zero.
W  ifail=2
The solution has failed to converge in maxit iterations. You should try a larger value of maxit or tol. The returned value will be an approximation to the correct value.
W  ifail=3
The probability is too close to 0.0 or 1.0 for the algorithm to be able to calculate the required probability. nag_stat_prob_beta_noncentral (g01ge) will return 0.0 or 1.0 as appropriate, this should be a reasonable approximation.
W  ifail=4
The required accuracy was not achieved when calculating the initial value of PBβ:a,b;λ. You should try a larger value of tol. The returned value will be an approximation to the correct value.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


Convergence is theoretically guaranteed whenever PY>maxittol where Y has a Poisson distribution with mean λ/2. Excessive round-off errors are possible when the number of iterations used is high and tol is close to machine precision. See Lenth (1987) for further comments on the error bound.

Further Comments

The central beta probabilities can be obtained by setting rlamda=0.0.


This example reads values for several beta distributions and calculates and prints the lower tail probabilities until the end of data is reached.
function g01ge_example

fprintf('g01ge example results\n\n');

x      = [ 0.25   0.75   0.5];
a      = [ 1      1.5    2  ];
b      = [ 2      1.5    1  ];
rlamda = [ 1      0.5    0  ];
p      = x;

fprintf('     x       a       b     rlamda    p\n');
for j = 1:numel(x)
   [p(j), ifail] = g01ge( ...
			  x(j), a(j), b(j), rlamda(j));

fprintf('%8.3f%8.3f%8.3f%8.3f%8.4f\n', [x; a; b; rlamda; p]);

g01ge example results

     x       a       b     rlamda    p
   0.250   1.000   2.000   1.000  0.3168
   0.750   1.500   1.500   0.500  0.7705
   0.500   2.000   1.000   0.000  0.2500

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–2015