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_chisq_noncentral_lincomb (g01jc)

Purpose

nag_stat_prob_chisq_noncentral_lincomb (g01jc) returns the lower tail probability of a distribution of a positive linear combination of χ2χ2 random variables.

Syntax

[p, pdf, ifail] = g01jc(a, mult, rlamda, c, 'n', n, 'tol', tol, 'maxit', maxit)
[p, pdf, ifail] = nag_stat_prob_chisq_noncentral_lincomb(a, mult, rlamda, c, 'n', n, '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

For a linear combination of noncentral χ2χ2 random variables with integer degrees of freedom the lower tail probability is
P
(n )
ajχ2(mj,λj)c
j = 1
,
P (j=1najχ2(mj,λj)c) ,
(1)
where ajaj and cc are positive constants and where χ2(mj,λj)χ2(mj,λj) represents an independent χ2χ2 random variable with mjmj degrees of freedom and noncentrality parameter λjλj. The linear combination may arise from considering a quadratic form in Normal variables.
Ruben's method as described in Farebrother (1984) is used. Ruben has shown that (1) may be expanded as an infinite series of the form
dkF(m + 2k,c / β),
k = 0
k=0dkF (m+2k,c/β) ,
(2)
where F (m + 2k,c / β) = P (χ2(m + 2k) < c / β) F (m+2k,c/β)=P (χ2(m+2k)<c/β) , i.e., the probability that a central χ2χ2 is less than c / βc/β.
The value of ββ is set at
β = βB = 2/( (1 / amin + 1 / amax) )
β=βB=2(1/amin+1/amax)
unless βB > 1.8aminβB>1.8amin, in which case
β = βA = amin
β=βA=amin
is used, where amin = min {aj}amin=min{aj} and amax = max {aj}amax=max{aj}, for j = 1,2,,nj=1,2,,n.

References

Farebrother R W (1984) The distribution of a positive linear combination of χ2χ2 random variables Appl. Statist. 33(3)

Parameters

Compulsory Input Parameters

1:     a(n) – double array
n, the dimension of the array, must satisfy the constraint n1n1.
The weights, a1,a2,,ana1,a2,,an.
Constraint: a(i) > 0.0ai>0.0, for i = 1,2,,ni=1,2,,n.
2:     mult(n) – int64int32nag_int array
n, the dimension of the array, must satisfy the constraint n1n1.
The degrees of freedom, m1,m2,,mnm1,m2,,mn.
Constraint: mult(i)1multi1, for i = 1,2,,ni=1,2,,n.
3:     rlamda(n) – double array
n, the dimension of the array, must satisfy the constraint n1n1.
The noncentrality parameters, λ1,λ2,,λnλ1,λ2,,λn.
Constraint: rlamda(i)0.0rlamdai0.0, for i = 1,2,,ni=1,2,,n.
4:     c – double scalar
cc, the point for which the lower tail probability is to be evaluated.
Constraint: c0.0c0.0.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The dimension of the arrays a, mult, rlamda. (An error is raised if these dimensions are not equal.)
nn, the number of χ2χ2 random variables in the combination, i.e., the number of terms in equation (1).
Constraint: n1n1.
2:     tol – double scalar
The relative accuracy required by you in the results. If nag_stat_prob_chisq_noncentral_lincomb (g01jc) 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.
Default: 00
3:     maxit – int64int32nag_int scalar
The maximum number of terms that should be used during the summation.
Default: 500500.
Constraint: maxit1maxit1.

Input Parameters Omitted from the MATLAB Interface

wrk

Output Parameters

1:     p – double scalar
The lower tail probability associated with the linear combination of nn χ2χ2 random variables with mjmj degrees of freedom, and noncentrality parameters λjλj, for j = 1,2,,nj=1,2,,n.
2:     pdf – double scalar
The value of the probability density function of the linear combination of χ2χ2 variables.
3:     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_chisq_noncentral_lincomb (g01jc) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
If on exit ifail = 1ifail=1 or 22, then nag_stat_prob_chisq_noncentral_lincomb (g01jc) returns 0.00.0.

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,n < 1n<1,
ormaxit < 1maxit<1,
orc < 0.0c<0.0.
  ifail = 2ifail=2
On entry,a has an element 0.00.0,
ormult has an element < 1<1,
orrlamda has an element < 0.0<0.0.
  ifail = 3ifail=3
The central χ2χ2 calculation has failed to converge. This is an unlikely exit. A larger value of tol should be tried.
W ifail = 4ifail=4
The solution has failed to converge within maxit iterations. A larger value of maxit or tol should be used. The returned value should be a reasonable approximation to the correct value.
W ifail = 5ifail=5
The solution appears to be too close to 00 or 11 for accurate calculation. The value returned is 00 or 11 as appropriate.

Accuracy

The series (2) is summed until a bound on the truncation error is less than tol. See Farebrother (1984) for further discussion.

Further Comments

None.

Example

function nag_stat_prob_chisq_noncentral_lincomb_example
a = [6;
     3;
     1];
mult = [int64(1);1;1];
rlamda = [0;
     0;
     0];
c = 20;
[p, pdf, ifail] = nag_stat_prob_chisq_noncentral_lincomb(a, mult, rlamda, c)
 

p =

    0.8760


pdf =

    0.0129


ifail =

                    0


function g01jc_example
a = [6;
     3;
     1];
mult = [int64(1);1;1];
rlamda = [0;
     0;
     0];
c = 20;
[p, pdf, ifail] = g01jc(a, mult, rlamda, c)
 

p =

    0.8760


pdf =

    0.0129


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