G01JCF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G01JCF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G01JCF returns the lower tail probability of a distribution of a positive linear combination of χ2 random variables.

2  Specification

SUBROUTINE G01JCF ( A, MULT, RLAMDA, N, C, P, PDF, TOL, MAXIT, WRK, IFAIL)
INTEGER  MULT(N), N, MAXIT, IFAIL
REAL (KIND=nag_wp)  A(N), RLAMDA(N), C, P, PDF, TOL, WRK(N+2*MAXIT)

3  Description

For a linear combination of noncentral χ2 random variables with integer degrees of freedom the lower tail probability is
P j=1najχ2mj,λjc , (1)
where aj and c are positive constants and where χ2mj,λj represents an independent χ2 random variable with mj degrees of freedom and noncentrality parameter λ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
k=0dkF m+2k,c/β , (2)
where F m+2k,c/β=P χ2m+2k<c/β , i.e., the probability that a central χ2 is less than c/β.
The value of β is set at
β=βB=21/amin+1/amax
unless βB>1.8amin, in which case
β=βA=amin
is used, where amin=minaj and amax=maxaj, for j=1,2,,n.

4  References

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

5  Parameters

1:     A(N) – REAL (KIND=nag_wp) arrayInput
On entry: the weights, a1,a2,,an.
Constraint: Ai>0.0, for i=1,2,,n.
2:     MULT(N) – INTEGER arrayInput
On entry: the degrees of freedom, m1,m2,,mn.
Constraint: MULTi1, for i=1,2,,N.
3:     RLAMDA(N) – REAL (KIND=nag_wp) arrayInput
On entry: the noncentrality parameters, λ1,λ2,,λn.
Constraint: RLAMDAi0.0, for i=1,2,,n.
4:     N – INTEGERInput
On entry: n, the number of χ2 random variables in the combination, i.e., the number of terms in equation (1).
Constraint: N1.
5:     C – REAL (KIND=nag_wp)Input
On entry: c, the point for which the lower tail probability is to be evaluated.
Constraint: C0.0.
6:     P – REAL (KIND=nag_wp)Output
On exit: the lower tail probability associated with the linear combination of n χ2 random variables with mj degrees of freedom, and noncentrality parameters λj, for j=1,2,,n.
7:     PDF – REAL (KIND=nag_wp)Output
On exit: the value of the probability density function of the linear combination of χ2 variables.
8:     TOL – REAL (KIND=nag_wp)Input
On entry: the relative accuracy required by you in the results. If G01JCF is entered with TOL greater than or equal to 1.0 or less than 10×machine precision (see X02AJF), then the value of 10×machine precision is used instead.
9:     MAXIT – INTEGERInput
On entry: the maximum number of terms that should be used during the summation.
Suggested value: 500.
Constraint: MAXIT1.
10:   WRK(N+2×MAXIT) – REAL (KIND=nag_wp) arrayWorkspace
11:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if IFAIL0 on exit, the recommended value is -1. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Note: G01JCF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
If on exit IFAIL=1 or 2, then G01JCF returns 0.0.
IFAIL=1
On entry,N<1,
orMAXIT<1,
orC<0.0.
IFAIL=2
On entry,A has an element 0.0,
orMULT has an element <1,
orRLAMDA has an element <0.0.
IFAIL=3
The central χ2 calculation has failed to converge. This is an unlikely exit. A larger value of TOL should be tried.
IFAIL=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.
IFAIL=5
The solution appears to be too close to 0 or 1 for accurate calculation. The value returned is 0 or 1 as appropriate.

7  Accuracy

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

8  Further Comments

None.

9  Example

The number of χ2 variables is read along with their coefficients, degrees of freedom and noncentrality parameters. The lower tail probability is then computed and printed.

9.1  Program Text

Program Text (g01jcfe.f90)

9.2  Program Data

Program Data (g01jcfe.d)

9.3  Program Results

Program Results (g01jcfe.r)


G01JCF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

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