NAG Library Function Document
nag_prob_chi_sq (g01ecc) returns the lower or upper tail probability for the -distribution with real degrees of freedom.
||nag_prob_chi_sq (Nag_TailProbability tail,
The lower tail probability for the
degrees of freedom,
is defined by:
a transformation of a gamma distribution is employed, i.e., a
degrees of freedom is equal to a gamma distribution with scale parameter
and shape parameter
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
tail – Nag_TailProbabilityInput
: 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., .
x – doubleInput
On entry: , the value of the variate with degrees of freedom.
df – doubleInput
On entry: , the degrees of freedom of the -distribution.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
- On any of the error conditions listed below except NE_ALG_NOT_CONV nag_prob_chi_sq (g01ecc) returns .
The series used to calculate the gamma probabilities has failed to converge.
The result returned should represent an approximation to the solution.
On entry, argument had an illegal value.
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
On entry, .
On entry, .
A relative accuracy of five significant figures is obtained in most cases.
For higher accuracy the transformation described in Section 3
may be used with a direct call to nag_incomplete_gamma (s14bac)
Values from various -distributions are read, the lower tail probabilities calculated, and all these values printed out, until the end of data is reached.
9.1 Program Text
Program Text (g01ecce.c)
9.2 Program Data
Program Data (g01ecce.d)
9.3 Program Results
Program Results (g01ecce.r)