Chapter 11: Probability Distribution Functions and Inverses > chi_squared_inverse_cdf

chi_squared_inverse_cdf

Evaluates the inverse of the chi-squared distribution function.

Synopsis

#include <imsls.h>

float imsls_f_chi_squared_inverse_cdf (float p, float df)

The type double function is imsls_d_chi_squared_inverse_cdf.

Required Arguments

float p   (Input)
Probability for which the inverse of the chi-squared distribution function is to be evaluated. Argument p must be in the open interval (0.0, 1.0).

float df   (Input)
Number of degrees of freedom of the chi-squared distribution. Argument df must be greater than 0.

Return Value

The inverse at the chi-squared distribution function evaluated at p. The probability that a chi-squared random variable takes a value less than or equal to imsls_f_chi_squared_inverse_cdf is p.

Description

Function imsls_f_chi_squared_inverse_cdf evaluates the inverse distribution function of a chi-squared random variable with ν = df and with probability p. That is, it determines x = imsls_f_chi_squared_inverse_cdf (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, imsls_f_chi_squared_inverse_cdf 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 IMSL function imsls_f_chi_squared_cdf.

For 40  ν < 100, a modified Wilson-Hilferty approximation (Abramowitz and Stegun 1964, Equation 26.4.18) to the normal distribution is used. IMSL function imsls_f_normal_cdf 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.

Example

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

 

#include <imsls.h>

#include <stdio.h>

 

int main ()

{   

    float  p = 0.99, df = 2.0, x;

 

    x  = imsls_f_chi_squared_inverse_cdf(p, df);

    printf("For p = %3.2f with %1.0f df, x = %7.3f.\n",

        p, df, x);

 

    df = 64.0;

    x  = imsls_f_chi_squared_inverse_cdf(p,df);

    printf("For p = %3.2f with %2.0f df, x = %7.3f.\n",

        p, df, x);

}

Output

 

For p = .99 with  2 df, x =   9.210.

For p = .99 with 64 df, x =  93.217.

Warning Errors

IMSLS_UNABLE_TO_BRACKET_VALUE  The bounds that enclose “p” could not be found. An approximation for imsls_f_chi_squared_inverse_cdf is returned.

IMSLS_CHI_2_INV_CDF_CONVERGENCE   The value of the inverse chi-squared could not be found within a specified number of iterations. An approximation for imsls_f_chi_squared_inverse_cdf is returned.


RW_logo.jpg
Contact Support