nag_prob_lin_chi_sq (g01jdc) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_prob_lin_chi_sq (g01jdc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagg01.h>
void  nag_prob_lin_chi_sq (Nag_LCCMethod method, Integer n, const double rlam[], double d, double c, double *prob, NagError *fail)

3  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_prob_lin_chi_sq (g01jdc) evaluates the probability that
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_prob_lin_chi_sq (g01jdc) returns the probability that
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 is used to compute the value of the integral otherwise nag_1d_quad_gen_1 (d01sjc) is used.
Pan's procedure can only be used if the λi* are sufficiently distinct; nag_prob_lin_chi_sq (g01jdc) requires the λi* to be at least 1% distinct; see Section 8. If the λi* are at least 1% distinct and n60, then Pan's procedure is recommended; otherwise Imhof's procedure is recommended.

4  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

5  Arguments

1:     methodNag_LCCMethodInput
On entry: indicates whether Pan's, Imhof's or an appropriately selected procedure is to be used.
Pan's method is used.
Imhof's method is used.
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=Nag_LCCPan, Nag_LCCImhof or Nag_LCCDefault.
2:     nIntegerInput
On entry: n, the number of independent standard Normal variates, (central χ2 variates).
Constraint: n1.
3:     rlam[n]const doubleInput
On entry: the weights, λi, for i=1,2,,n, of the central χ2 variables.
Constraint: rlam[i-1]d for at least one i. If method=Nag_LCCPan, then the λi* must be at least 1% distinct; see Section 8, for i=1,2,,n.
4:     ddoubleInput
On entry: d, the multiplier of the central χ2 variables.
Constraint: d0.0.
5:     cdoubleInput
On entry: c, the value of the constant.
6:     probdouble *Output
On exit: the lower tail probability for the linear combination of central χ2 variables.
7:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

Dynamic memory allocation failed.
On entry, argument value had an illegal value.
On entry, n=value.
Constraint: n1.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
On entry, d=value.
Constraint: d0.0.
On entry, all values of rlam=d.
On entry, method=Nag_LCCPan but two successive values of λ* were not 1 percent distinct.

7  Accuracy

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

8  Further Comments

Pan's procedure can only work if the λi* are sufficiently distinct. nag_prob_lin_chi_sq (g01jdc) 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_prob_lin_non_central_chi_sq (g01jcc) may be used. If the probabilities required are for the Durbin–Watson test, then the bounds for the probabilities are given by nag_prob_durbin_watson (g01epc).

9  Example

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

9.1  Program Text

Program Text (g01jdce.c)

9.2  Program Data

Program Data (g01jdce.d)

9.3  Program Results

Program Results (g01jdce.r)

nag_prob_lin_chi_sq (g01jdc) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012