9.4.9 The χ2 distribution
The probability density function for the χ2 distribution: chisquare
The χ2 distribution with n degrees of freedom has density
function given by
The chisquare command computes this density function.
-
chisquare takes two arguments:
-
n, an integer (the degrees of freedom).
- x, a real number.
- chisquare(n,x) returns the value of the χ2
density function with n degrees of freedom, given in (6).
Example.
Input:
chisquare(5,2)
Output:
which can be numerically approximated by:
Input:
evalf(chisquare(5,2))
Output:
The cumulative distribution function for the χ2 distribution: chisquare_cdf
The chisquare_cdf command computes
the cumulative distribution function for the χ2 distribution.
-
chisquare_cdf takes two mandatory arguments and one
optional argument:
-
n, an integer (the degrees of freedom).
- x, a real number.
- Optionally, y, a real number.
- chisquare_cdf(n,x) returns
Prob(X ≤ x) for the χ2 distribution with n
degrees of freedom.
- chisquare_cdf(n,x,y) returns
Prob(x ≤ X < y).
Examples.
-
Input:
chisquare_cdf(5,11)
Output:
- Input:
chisquare_cdf(3,1,2)
Output:
The inverse distribution function for the χ2 distribution: chisquare_icdf
The chisquare_icdf command computes
the inverse distribution for the χ2 distribution.
-
chisquare_icdf takes two arguments:
-
n, an integer (the degrees of freedom).
- h, a real number between 0 and 1.
- chisquare_icdf(n, h) returns the inverse
distribution for the χ2 distribution with n degrees of
freedom; namely, the value of x for which
Prob(X ≤ x) = h.
Example.
Input:
chisquare_icdf(5,0.95)
Output:
The upper tail cumulative function for the χ2 distribution: UTPC
The UTPC (the Upper Tail Probability - Chi-square
distribution)
computes Prob(X > x) for the χ2 distribution.
-
UTPC takes two arguments:
-
n, an integer (the degrees of freedom).
- x, a real number.
- UTPC(n,x) returns
Prob(X > x) for the χ2 distribution with n
degrees of freedom.
Example.
Input:
UTPC(5,11)
Output: