PDF version (NAG web site
, 64-bit version, 64-bit version)
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 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:
At Mark 23: |
tol was made optional (default 0) |
Description
For a linear combination of noncentral
random variables with integer degrees of freedom the lower tail probability is
where
and
are positive constants and where
represents an independent
random variable with
degrees of freedom and noncentrality argument
. 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
where
, i.e., the probability that a central
is less than
.
The value of
is set at
unless
, in which case
is used, where
and
, for
.
References
Farebrother R W (1984) The distribution of a positive linear combination of random variables Appl. Statist. 33(3)
Parameters
Compulsory Input Parameters
- 1:
– double array
-
The weights, .
Constraint:
, for .
- 2:
– int64int32nag_int array
-
The degrees of freedom, .
Constraint:
, for .
- 3:
– double array
-
The noncentrality parameters, .
Constraint:
, for .
- 4:
– double scalar
-
, the point for which the lower tail probability is to be evaluated.
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
a,
mult,
rlamda. (An error is raised if these dimensions are not equal.)
, the number of
random variables in the combination, i.e., the number of terms in equation
(1).
Constraint:
.
- 2:
– double scalar
Default:
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
or less than
(see
nag_machine_precision (x02aj)), then the value of
is used instead.
- 3:
– int64int32nag_int scalar
Default:
.
The maximum number of terms that should be used during the summation.
Constraint:
.
Output Parameters
- 1:
– double scalar
-
The lower tail probability associated with the linear combination of random variables with
degrees of freedom, and noncentrality arguments , for .
- 2:
– double scalar
-
The value of the probability density function of the linear combination of variables.
- 3:
– int64int32nag_int scalar
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 or , then nag_stat_prob_chisq_noncentral_lincomb (g01jc) returns .
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
On entry, | , |
or | , |
or | . |
-
-
On entry, | a has an element , |
or | mult has an element , |
or | rlamda has an element . |
-
-
The central
calculation has failed to converge. This is an unlikely exit. A larger value of
tol should be tried.
- W
-
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
-
The solution appears to be too close to or for accurate calculation. The value returned is or as appropriate.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
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
The number of variables is read along with their coefficients, degrees of freedom and noncentrality arguments. The lower tail probability is then computed and printed.
Open in the MATLAB editor:
g01jc_example
function g01jc_example
fprintf('g01jc example results\n\n');
fprintf(' a mult rlamda\n');
a = [ 6 3 1];
mult = [int64(1) 1 1];
rlamda = [ 0 0 0];
c = 20;
[p1, pdf, ifail] = g01jc( ...
a, mult, rlamda, c);
fprintf('%10.2f%6d%9.2f\n',[a; mult; rlamda]);
fprintf('c = %6.2f prob = %6.4f\n\n', c, p1);
a = [ 7 3];
mult = [int64(1) 1];
rlamda = [ 6 2];
c = 10;
[p2, pdf, ifail] = g01jc( ...
a, mult, rlamda, c);
fprintf('%10.2f%6d%9.2f\n',[a; mult; rlamda]);
fprintf('c = %6.2f prob = %6.4f\n', c, p2);
g01jc example results
a mult rlamda
6.00 1 0.00
3.00 1 0.00
1.00 1 0.00
c = 20.00 prob = 0.8760
7.00 1 6.00
3.00 1 2.00
c = 10.00 prob = 0.0451
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015