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)

Purpose

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

Syntax

[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:
Mark 23: tol now optional (default 0)
.

Description

The lower tail probability for the noncentral beta distribution with parameters aa and bb and noncentrality parameter λλ, P(Bβ : a,b;λ)P(Bβ:a,b;λ), is defined by
P(Bβ : a,b;λ) = eλ / 2((λ / 2))/(j ! )P(Bβ : a,b;0),
j = 0
P(Bβ:a,b;λ)=j=0e-λ/2 (λ/2) j! P(Bβ:a,b;0),
(1)
where
β
P(Bβ : a,b;0) = (Γ (a + b))/(Γ (a)Γ (b))Ba 1(1B)b 1dB,
0
P(Bβ : a,b;0)=Γ (a+b) Γ (a)Γ (b) 0βBa- 1(1-B)b- 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 P(Bβ : a,b;0)P(Bβ:a,b;0) for each step of the summation (1).
The algorithm is discussed in Lenth (1987).

References

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

Parameters

Compulsory Input Parameters

1:     x – double scalar
ββ, the deviate from the beta distribution, for which the probability P(Bβ : a,b;λ)P(Bβ:a,b;λ) is to be found.
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.
4:     rlamda – double scalar
λλ, the noncentrality parameter of the required beta distribution.
Constraint: 0.0rlamda2.0log(U)0.0rlamda-2.0log(U), where UU is the safe range parameter as defined by nag_machine_real_safe (x02am).

Optional Input Parameters

1:     tol – double scalar
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.01.0 or less than 10 × machine precision10×machine precision (see nag_machine_precision (x02aj)), then the value of 10 × machine precision10×machine precision is used instead.
See Section [Accuracy] for the relationship between tol and maxit.
Default: 0.00.0
2:     maxit – int64int32nag_int scalar
The maximum number of iterations that the algorithm should use.
See Section [Accuracy] for suggestions as to suitable values for maxit for different values of the parameters.
Default: 500500.
Constraint: maxit1maxit1.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     result – double scalar
The result of the function.
2:     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_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.

  ifail = 1ifail=1
On entry,a0.0a0.0,
ora > 106a>106,
orb0.0b0.0,
orb > 106b>106,
orrlamda < 0.0rlamda<0.0,
orrlamda > 2.0log(U)rlamda>-2.0log(U), where U = U= safe range parameter as defined by nag_machine_real_safe (x02am),
orx < 0.0x<0.0,
orx > 1.0x>1.0,
ormaxit < 1maxit<1.
If on exit ifail = 1ifail=1 then nag_stat_prob_beta_noncentral (g01ge) returns zero.
W ifail = 2ifail=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 = 3ifail=3
The probability is too close to 0.00.0 or 1.01.0 for the algorithm to be able to calculate the required probability. nag_stat_prob_beta_noncentral (g01ge) will return 0.00.0 or 1.01.0 as appropriate, this should be a reasonable approximation.
W ifail = 4ifail=4
The required accuracy was not achieved when calculating the initial value of P(Bβ : a,b;λ)P(Bβ:a,b;λ). You should try a larger value of tol. The returned value will be an approximation to the correct value.

Accuracy

Convergence is theoretically guaranteed whenever P(Y > maxit)tolP(Y>maxit)tol where YY has a Poisson distribution with mean λ / 2λ/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.0rlamda=0.0.

Example

function nag_stat_prob_beta_noncentral_example
x = 0.25;
a = 1;
b = 2;
rlamda = 1;
[result, ifail] = nag_stat_prob_beta_noncentral(x, a, b, rlamda)
 

result =

    0.3168


ifail =

                    0


function g01ge_example
x = 0.25;
a = 1;
b = 2;
rlamda = 1;
[result, ifail] = g01ge(x, a, b, rlamda)
 

result =

    0.3168


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