CHIIN

This function evaluates the inverse of the chi‑squared cumulative distribution function.

Function Return Value

CHIIN — Function value. (Output)
The probability that a chi‑squared random variable takes a value less than or equal to CHIIN is P.

Required Arguments

P — Probability for which the inverse of the chi‑squared distribution function is to be evaluated. (Input)
P must be in the open interval (0.0, 1.0).

DF — Number of degrees of freedom of the chi‑squared distribution. (Input)
DF must be greater than or equal to 0.5.

FORTRAN 90 Interface

Generic: CHIIN (P, DF)

Specific: The specific interface names are S_CHIIN and D_CHIIN.

FORTRAN 77 Interface

Single: CHIIN (P, DF)

Double: The double precision name is DCHIIN.

Description

Function CHIIN evaluates the inverse distribution function of a chi‑squared random variable with DF degrees of freedom, that is, with P = P and ν = DF, it determines x (equal to CHIIN(PDF)), such that

 

where Γ() is the gamma function. The probability that the random variable takes a value less than or equal to x is P.

For ν < 40, CHIIN uses bisection (if ν  2 or P > 0.98) or regula falsi to find the point at which the chi‑squared distribution function is equal to P. The distribution function is evaluated using routine CHIDF.

For 40  ν < 100, a modified Wilson‑Hilferty approximation (Abramowitz and Stegun 1964, equation 26.4.18) to the normal distribution is used, and routine ANORIN is used to evaluate the inverse of the normal distribution function. For ν  100, the ordinary Wilson‑Hilferty approximation (Abramowitz and Stegun 1964, equation 26.4.17) is used.

Comments

Informational Error

 

Type

Code

Description

4

1

Over 100 iterations have occurred without convergence. Convergence is assumed.

Example

In this example, we find the 99‑th percentage points of a chi‑squared random variable with 2 degrees of freedom and of one with 64 degrees of freedom.

 

USE UMACH_INT

USE CHIIN_INT

IMPLICIT NONE

INTEGER NOUT

REAL DF, P, X

!

CALL UMACH (2, NOUT)

P = 0.99

DF = 2.0

X = CHIIN(P,DF)

WRITE (NOUT,99998) X

99998 FORMAT (' The 99-th percentage point of chi-squared with 2 df ' &

, 'is ', F7.3)

DF = 64.0

X = CHIIN(P,DF)

WRITE (NOUT,99999) X

99999 FORMAT (' The 99-th percentage point of chi-squared with 64 df ' &

, 'is ', F7.3)

END

Output

 

The 99-th percentage point of chi-squared with 2 df is 9.210

The 99-th percentage point of chi-squared with 64 df is 93.217