PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_inv_cdf_chisq (g01fc)
Purpose
nag_stat_inv_cdf_chisq (g01fc) returns the deviate associated with the given lower tail probability of the -distribution with real degrees of freedom.
Syntax
Description
The deviate,
, associated with the lower tail probability
of the
-distribution with
degrees of freedom is defined as the solution to
The required
is found by using the relationship between a
-distribution and a gamma distribution, i.e., a
-distribution with
degrees of freedom is equal to a gamma distribution with scale parameter
and shape parameter
.
For very large values of
, greater than
, Wilson and Hilferty's normal approximation to the
is used; see
Kendall and Stuart (1969).
References
Best D J and Roberts D E (1975) Algorithm AS 91. The percentage points of the distribution Appl. Statist. 24 385–388
Hastings N A J and Peacock J B (1975) Statistical Distributions Butterworth
Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin
Parameters
Compulsory Input Parameters
- 1:
– double scalar
-
, the lower tail probability from the required -distribution.
Constraint:
.
- 2:
– double scalar
-
, the degrees of freedom of the -distribution.
Constraint:
.
Optional Input Parameters
None.
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_inv_cdf_chisq (g01fc) 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_inv_cdf_chisq (g01fc) returns .
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
-
-
-
-
p is too close to
or
for the result to be calculated.
- W
-
The solution has failed to converge. The result should be a reasonable approximation.
-
-
The series used to calculate the gamma function has failed to converge. This is an unlikely error exit.
-
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 results should be accurate to five significant digits for most argument values. Some accuracy is lost for close to .
Further Comments
For higher accuracy the relationship described in
Description may be used and a direct call to
nag_stat_inv_cdf_gamma (g01ff) made.
Example
This example reads lower tail probabilities for several -distributions, and calculates and prints the corresponding deviates until the end of data is reached.
Open in the MATLAB editor:
g01fc_example
function g01fc_example
fprintf('g01fc example results\n\n');
p = [ 0.01; 0.428; 0.869];
df = [20.00; 7.500; 45.000];
fprintf(' p df x\n');
for j = 1:numel(p);
[x, ifail] = g01fc( ...
p(j) , df(j));
fprintf('%9.3f%8.3f%8.3f\n', p(j), df(j), x);
end
g01fc example results
p df x
0.010 20.000 8.260
0.428 7.500 6.201
0.869 45.000 55.738
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015