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_lincomb (g01jd)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_stat_prob_chisq_lincomb (g01jd) calculates the lower tail probability for a linear combination of (central) χ2 variables.

Syntax

[prob, ifail] = g01jd(rlam, d, c, 'method', method, 'n', n)
[prob, ifail] = nag_stat_prob_chisq_lincomb(rlam, d, c, 'method', method, 'n', n)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: method was made optional (default 'D')

Description

Let u1,u2,,un be independent Normal variables with mean zero and unit variance, so that u12,u22,,un2 have independent χ2-distributions with unit degrees of freedom. nag_stat_prob_chisq_lincomb (g01jd) evaluates the probability that
λ1u12+λ2u22++λnun2<du12+u22++un2+c.  
If c=0.0 this is equivalent to the probability that
λ1u12+λ2u22++λnun2 u12+u22++un2 <d.  
Alternatively let
λi*=λi-d,   ​ i= 1,2,,n,  
then nag_stat_prob_chisq_lincomb (g01jd) returns the probability that
λ1*u12+λ2*u22++λn*un2<c.  
Two methods are available. One due to Pan (1964) (see Farebrother (1980)) makes use of series approximations. The other method due to Imhof (1961) reduces the problem to a one-dimensional integral. If n6 then a non-adaptive method described in nag_quad_1d_fin_smooth (d01bd) is used to compute the value of the integral otherwise nag_quad_1d_fin_bad (d01aj) is used.
Pan's procedure can only be used if the λi* are sufficiently distinct; nag_stat_prob_chisq_lincomb (g01jd) requires the λi* to be at least 1% distinct; see Further Comments. If the λi* are at least 1% distinct and n60, then Pan's procedure is recommended; otherwise Imhof's procedure is recommended.

References

Farebrother R W (1980) Algorithm AS 153. Pan's procedure for the tail probabilities of the Durbin–Watson statistic Appl. Statist. 29 224–227
Imhof J P (1961) Computing the distribution of quadratic forms in Normal variables Biometrika 48 419–426
Pan Jie–Jian (1964) Distributions of the noncircular serial correlation coefficients Shuxue Jinzhan 7 328–337

Parameters

Compulsory Input Parameters

1:     rlamn – double array
The weights, λi, for i=1,2,,n, of the central χ2 variables.
Constraint: rlamid for at least one i. If method='P', then the λi* must be at least 1% distinct; see Further Comments, for i=1,2,,n.
2:     d – double scalar
d, the multiplier of the central χ2 variables.
Constraint: d0.0.
3:     c – double scalar
c, the value of the constant.

Optional Input Parameters

1:     method – string (length ≥ 1)
Default: 'D'
Indicates whether Pan's, Imhof's or an appropriately selected procedure is to be used.
method='P'
Pan's method is used.
method='I'
Imhof's method is used.
method='D'
Pan's method is used if λi*, for i=1,2,,n are at least 1% distinct and n60; otherwise Imhof's method is used.
Constraint: method='P', 'I' or 'D'.
2:     n int64int32nag_int scalar
Default: the dimension of the array rlam.
n, the number of independent standard Normal variates, (central χ2 variates).
Constraint: n1.

Output Parameters

1:     prob – double scalar
The lower tail probability for the linear combination of central χ2 variables.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,n<1,
ord<0.0,
ormethod'P', 'I' or 'D'.
   ifail=2
On entry, rlami=d for all values of i, for i=1,2,,n.
   ifail=3
On entry, method='P' yet two successive values of the ordered λi*, for i=1,2,,n, were not at least 1% distinct.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

On successful exit at least four decimal places of accuracy should be achieved.

Further Comments

Pan's procedure can only work if the λi* are sufficiently distinct. nag_stat_prob_chisq_lincomb (g01jd) uses the check wj-wj-10.01×maxwj,wj-1, where the wj are the ordered nonzero values of λi*.
For the situation when all the λi are positive nag_stat_prob_chisq_noncentral_lincomb (g01jc) may be used. If the probabilities required are for the Durbin–Watson test, then the bounds for the probabilities are given by nag_stat_prob_durbin_watson (g01ep).

Example

For n=10, the choice of method, values of c and d and the λi are input and the probabilities computed and printed.
function g01jd_example


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

method = 'P';
rlam = [-9 -7 -5 -3 -1  2  4  6  8  10];
d = 1;
c = 0;

[p, ifail] = g01jd( ...
		    rlam, d, c, 'method', method);

fprintf('lambda = ');
fprintf('%6.1f',rlam);
fprintf('\n     d = %6.1f\n', d);
fprintf('     c = %6.1f\n\n', c);
fprintf('  prob = %9.4f\n', p);


g01jd example results

lambda =   -9.0  -7.0  -5.0  -3.0  -1.0   2.0   4.0   6.0   8.0  10.0
     d =    1.0
     c =    0.0

  prob =    0.5749

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