PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_prob_chisq (g01ec)
Purpose
nag_stat_prob_chisq (g01ec) returns the lower or upper tail probability for the -distribution with real degrees of freedom.
Syntax
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
tail was made optional (default 'L') |
Description
The lower tail probability for the
-distribution with
degrees of freedom,
is defined by:
To calculate
a transformation of a gamma distribution is employed, i.e., a
-distribution with
degrees of freedom is equal to a gamma distribution with scale parameter
and shape parameter
.
References
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
Parameters
Compulsory Input Parameters
- 1:
– double scalar
-
, the value of the variate with degrees of freedom.
Constraint:
.
- 2:
– double scalar
-
, the degrees of freedom of the -distribution.
Constraint:
.
Optional Input Parameters
- 1:
– string (length ≥ 1)
Default:
Indicates whether the upper or lower tail probability is required.
- The lower tail probability is returned, i.e., .
- The upper tail probability is returned, i.e., .
Constraint:
or .
Output Parameters
- 1:
– double scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_stat_prob_chisq (g01ec) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
If , or on exit, then nag_stat_prob_chisq (g01ec) returns .
-
-
On entry, | or . |
-
-
-
-
-
-
The solution has failed to converge while calculating the gamma variate. The result returned should represent an approximation to the solution.
-
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
A relative accuracy of five significant figures is obtained in most cases.
Further Comments
For higher accuracy the transformation described in
Description may be used with a direct call to
nag_specfun_gamma_incomplete (s14ba).
Example
Values from various -distributions are read, the lower tail probabilities calculated, and all these values printed out, until the end of data is reached.
Open in the MATLAB editor:
g01ec_example
function g01ec_example
fprintf('g01ec example results\n\n');
x = [ 8.26; 6.2; 55.76];
df = [20.00; 7.5; 45.00];
tail = {'Lower'; 'Lower'; 'Lower';};
fprintf(' Tail x df probability\n');
for j = 1:numel(x);
[p, ifail] = g01ec( ...
x(j), df(j), 'tail', tail{j});
fprintf('%4s%8.3f%8.1f%12.4f\n',tail{j}(1), x(j), df(j), p);
end
g01ec example results
Tail x df probability
L 8.260 20.0 0.0100
L 6.200 7.5 0.4279
L 55.760 45.0 0.8694
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015