NAG Library Routine Document
g01fcf
(inv_cdf_chisq)
1
Purpose
g01fcf returns the deviate associated with the given lower tail probability of the -distribution with real degrees of freedom, via the routine name.
2
Specification
Fortran Interface
Real (Kind=nag_wp) | :: | g01fcf | Integer, Intent (Inout) | :: |
ifail | Real (Kind=nag_wp), Intent (In) | :: |
p,
df |
|
C Header Interface
#include nagmk26.h
double |
g01fcf_ (
const double *p,
const double *df,
Integer *ifail) |
|
3
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).
4
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
5
Arguments
- 1: – Real (Kind=nag_wp)Input
-
On entry: , the lower tail probability from the required -distribution.
Constraint:
.
- 2: – Real (Kind=nag_wp)Input
-
On entry: , the degrees of freedom of the -distribution.
Constraint:
.
- 3: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, because for this routine the values of the output arguments may be useful even if
on exit, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Note: g01fcf may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
If , , or on exit, then g01fcf returns .
-
On entry, .
Constraint: .
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
The probability is too close to or .
-
The algorithm has failed to converge in iterations. 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.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
The results should be accurate to five significant digits for most argument values. Some accuracy is lost for close to .
8
Parallelism and Performance
g01fcf is not threaded in any implementation.
For higher accuracy the relationship described in
Section 3 may be used and a direct call to
g01fff made.
10
Example
This example reads lower tail probabilities for several -distributions, and calculates and prints the corresponding deviates until the end of data is reached.
10.1
Program Text
Program Text (g01fcfe.f90)
10.2
Program Data
Program Data (g01fcfe.d)
10.3
Program Results
Program Results (g01fcfe.r)