The function may be called by the names: g01fcc, nag_stat_inv_cdf_chisq or nag_deviates_chi_sq.
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).
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
1: – doubleInput
On entry: , the lower tail probability from the required -distribution.
2: – doubleInput
On entry: , the degrees of freedom of the -distribution.
3: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
On any of the error conditions listed below except NE_ALG_NOT_CONVg01fcc returns .
The algorithm has failed to converge in iterations. The result should be a reasonable approximation.
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
The series used to calculate the gamma function has failed to converge. This is an unlikely error exit.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
The probability is too close to or .
On entry, .
On entry, .
On entry, .
The results should be accurate to five significant digits for most argument values. Some accuracy is lost for close to .
8Parallelism and Performance
g01fcc is not threaded in any implementation.
For higher accuracy the relationship described in Section 3 may be used and a direct call to g01ffc made.
This example reads lower tail probabilities for several -distributions, and calculates and prints the corresponding deviates until the end of data is reached.