Chapter 11: Probability Distribution Functions and Inverses

chi_squared_cdf

Evaluates the chi-squared distribution function.

Synopsis

#include <imsls.h>

float imsls_f_chi_squared_cdf (float chi_squared, float df)

The type double function is imsls_d_chi_squared_cdf.

Required Arguments

float chi_squared   (Input)
Argument for which the chi-squared distribution function is to be evaluated.

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

Return Value

The probability that a chi-squared random variable takes a value less than or equal to chi_squared.

Description

Function imsls_f_chi_squared_cdf evaluates the distribution function, F, of a chi-squared random variable x = chi_squared with ν = df. Then,

where Γ (×) is the gamma function. The value of the distribution function at the point x is the probability that the random variable takes a value less than or equal to x.

For ν > 65, imsls_f_chi_squared_cdf uses the Wilson-Hilferty approximation (Abramowitz and Stegun 1964, Equation 26.4.17) to the normal distribution, and function imsls_f_normal_cdf is used to evaluate the normal distribution function.

For ν £ 65, imsls_f_chi_squared_cdf uses series expansions to evaluate the distribution function. If x < max (ν / 2, 26), imsls_f_chi_squared_cdf uses the series 6.5.29 in Abramowitz and Stegun (1964); otherwise, it uses the asymptotic expansion 6.5.32 in Abramowitz and Stegun.

Example

Suppose X is a chi-squared random variable with two degrees of freedom. In this example, we find the probability that X is less than 0.15 and the probability that
X is greater than 3.0.

#include <imsls.h>

 

int main()

{

    float       chi_squared = 0.15;

    float       df = 2.0;

    float       p;

 

    p    = imsls_f_chi_squared_cdf(chi_squared, df);

    printf("%s %s %6.4f\n", "The probability that chi-squared\n",

        "with 2 df is less than 0.15 is", p);

 

    chi_squared = 3.0;

    p    = 1.0 - imsls_f_chi_squared_cdf(chi_squared, df);

    printf("%s %s %6.4f\n", "The probability that chi-squared\n",

        "with 2 df is greater than 3.0 is", p);

}

Output

The probability that chi-squared

 with 2 df is less than 0.15 is 0.0723

The probability that chi-squared

 with 2 df is greater than 3.0 is 0.2231

Informational Errors

IMSLS_ARG_LESS_THAN_ZERO                Since “chi_squared” = # is less than zero, the distribution function is zero at “chi_squared.”

Alert Errors

IMSLS_NORMAL_UNDERFLOW                     Using the normal distribution for large degrees of freedom, underflow would have occurred.


Visual Numerics, Inc.
Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260