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

Syntax

C#
public static void g01jc(
	double[] a,
	int[] mult,
	double[] rlamda,
	int n,
	double c,
	out double p,
	out double pdf,
	double tol,
	int maxit,
	out int ifail
)
Visual Basic
Public Shared Sub g01jc ( _
	a As Double(), _
	mult As Integer(), _
	rlamda As Double(), _
	n As Integer, _
	c As Double, _
	<OutAttribute> ByRef p As Double, _
	<OutAttribute> ByRef pdf As Double, _
	tol As Double, _
	maxit As Integer, _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g01jc(
	array<double>^ a, 
	array<int>^ mult, 
	array<double>^ rlamda, 
	int n, 
	double c, 
	[OutAttribute] double% p, 
	[OutAttribute] double% pdf, 
	double tol, 
	int maxit, 
	[OutAttribute] int% ifail
)
F#
static member g01jc : 
        a : float[] * 
        mult : int[] * 
        rlamda : float[] * 
        n : int * 
        c : float * 
        p : float byref * 
        pdf : float byref * 
        tol : float * 
        maxit : int * 
        ifail : int byref -> unit 

Parameters

a
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: the weights, a1,a2,,an.
Constraint: a[i]>0.0, for i=0,1,,n-1.
mult
Type: array<System..::..Int32>[]()[][]
An array of size [n]
On entry: the degrees of freedom, m1,m2,,mn.
Constraint: mult[i]1, for i=0,1,,n-1.
rlamda
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: the noncentrality parameters, λ1,λ2,,λn.
Constraint: rlamda[i]0.0, for i=0,1,,n-1.
n
Type: System..::..Int32
On entry: n, the number of χ2 random variables in the combination, i.e., the number of terms in equation (1).
Constraint: n1.
c
Type: System..::..Double
On entry: c, the point for which the lower tail probability is to be evaluated.
Constraint: c0.0.
p
Type: System..::..Double%
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.
pdf
Type: System..::..Double%
On exit: the value of the probability density function of the linear combination of χ2 variables.
tol
Type: System..::..Double
On entry: the relative accuracy required by you in the results. If g01jc is entered with tol greater than or equal to 1.0 or less than 10×machine precision (see x02aj), then the value of 10×machine precision is used instead.
maxit
Type: System..::..Int32
On entry: the maximum number of terms that should be used during the summation.
Suggested value: 500.
Constraint: maxit1.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

For a linear combination of noncentral χ2 random variables with integer degrees of freedom the lower tail probability is
Pj=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=0dkFm+2k,c/β, (2)
where Fm+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.

References

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

Error Indicators and Warnings

Note: g01jc may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
If on exit ifail=1 or 2, then g01jc 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.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

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

Parallelism and Performance

None.

Further Comments

None.

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.

Example program (C#): g01jce.cs

Example program data: g01jce.d

Example program results: g01jce.r

See Also