Evaluates the chi-squared distribution function.
#include <imsl.h>
float imsl_f_chi_squared_cdf (float chi_squared, float df)
The type double function is imsl_d_chi_squared_cdf.
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. The
argument df must
be greater than or equal to 0.5.
The probability that a chi-squared random variable takes a value less than or equal to chi_squared.
The function imsl_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, imsl_f_chi_squared_cdf uses the Wilson-Hilferty approximation (Abramowitz and Stegun 1964, Equation 26.4.17) to the normal distribution, and function imsl_f_normal_cdf is used to evaluate the normal distribution function.
For ν ≤ 65, imsl_f_chi_squared_cdf uses series expansions to evaluate the distribution function. If x < max (ν/2, 26), imsl_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.
Suppose X is a chi-squared random variable with 2 degrees of freedom. This example finds the probability that X is less than 0.15 and the probability that X is greater than 3.0.
#include <imsl.h>
void
main()
{
float
chi_squared = 0.15;
float df = 2.0;
float p;
p = imsl_f_chi_squared_cdf(chi_squared,
df);
printf("%s %s %6.4f\n", "The probability that
chi-squared",
"with 2 df is less than 0.15 is", p);
chi_squared =
3.0;
p = 1.0 -
imsl_f_chi_squared_cdf(chi_squared, df);
printf("%s %s
%6.4f\n", "The probability that
chi-squared",
"with 2 df is greater than 3.0 is", p);
}
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
IMSL_ARG_LESS_THAN_ZERO The input argument, chi_squared, is less than zero.
IMSL_NORMAL_UNDERFLOW Using the normal distribution for large degrees of freedom, underflow would have occurred.
|
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |