Main Content

Chi-Square Distribution

Overview

The chi-square (χ2) distribution is a one-parameter family of curves. The chi-square distribution is commonly used in hypothesis testing, particularly the chi-square test for goodness of fit.

Statistics and Machine Learning Toolbox™ offers multiple ways to work with the chi-square distribution.

  • Use distribution-specific functions (chi2cdf,chi2inv,chi2pdf,chi2rnd,chi2stat) with specified distribution parameters. The distribution-specific functions can accept parameters of multiple chi-square distributions.

  • Use generic distribution functions (cdf,icdf,pdf,random) with a specified distribution name ('Chisquare') and parameters.

Parameters

The chi-square distribution uses the following parameter.

Parameter Description 金宝app
nu (ν) Degrees of freedom ν= 1, 2, 3,...

The degrees of freedom parameter is typically an integer, but chi-square functions accept any positive value.

The sum of two chi-square random variables with degrees of freedomν1andν2is a chi-square random variable with degrees of freedomν=ν1+ν2

Probability Density Function

The probability density function (pdf) of the chi-square distribution is

y = f ( x | ν ) = x ( ν 2 ) / 2 e x / 2 2 ν 2 Γ ( ν / 2 ) ,

whereνis the degrees of freedom and Γ( · ) is the Gamma function.

For an example, seeCompute Chi-Square Distribution pdf

Cumulative Distribution Function

The cumulative distribution function (cdf) of the chi-square distribution is

p = F ( x | ν ) = 0 x t ( ν 2 ) / 2 e t / 2 2 ν / 2 Γ ( ν / 2 ) d t ,

whereνis the degrees of freedom and Γ( · ) is the Gamma function. The resultpis the probability that a single observation from the chi-square distribution withνdegrees of freedom falls in the interval[0,x]

For an example, seeCompute Chi-Square Distribution cdf

Inverse Cumulative Distribution Function

The inverse cumulative distribution function (icdf) of the chi-square distribution is

x = F 1 ( p | ν ) = { x : F ( x | ν ) = p } ,

where

p = F ( x | ν ) = 0 x t ( ν 2 ) / 2 e t / 2 2 ν / 2 Γ ( ν / 2 ) d t ,

ν自由度,Γγ(·)function. The resultpis the probability that a single observation from the chi-square distribution withνdegrees of freedom falls in the interval[0,x]

Descriptive Statistics

The mean of the chi-square distribution isν

The variance of the chi-square distribution is2ν

Examples

Compute Chi-Square Distribution pdf

Compute the pdf of a chi-square distribution with 4 degrees of freedom.

x = 0:0.2:15; y = chi2pdf(x,4);

Plot the pdf.

figure; plot(x,y) xlabel('Observation') ylabel('Probability Density')

Figure contains an axes object. The axes object contains an object of type line.

The chi-square distribution is skewed to the right, especially for few degrees of freedom.

Compute Chi-Square Distribution cdf

Compute the cdf of a chi-square distribution with 4 degrees of freedom.

x = 0:0.2:15; y = chi2cdf(x,4);

Plot the cdf.

figure; plot(x,y) xlabel('Observation') ylabel('Cumulative Probability')

Figure contains an axes object. The axes object contains an object of type line.

Related Distributions

  • F Distribution— TheFdistribution is a two-parameter distribution that has parametersν1(numerator degrees of freedom) andν2(denominator degrees of freedom). TheFdistribution can be defined as the ratio F = χ 1 2 ν 1 χ 2 2 ν 2 , whereχ21andχ22are both chi-square distributed withν1andν2degrees of freedom, respectively.

  • Gamma Distribution— The gamma distribution is a two-parameter continuous distribution that has parametersa(shape) andb(scale). The chi-square distribution is equal to the gamma distribution with2a=νandb=2

  • Noncentral Chi-Square Distribution— The noncentral chi-square distribution is a two-parameter continuous distribution that has parametersν(degrees of freedom) andδ(noncentrality). The noncentral chi-square distribution is equal to the chi-square distribution whenδ=0

  • Normal Distribution— The normal distribution is a two-parameter continuous distribution that has parametersμ(mean) andσ(standard deviation). The standard normal distribution occurs whenμ=0andσ=1

    IfZ1,Z2, …,Znare standard normal random variables, then i = 1 n Z i 2 has a chi-square distribution with degrees of freedomν=n– 1

    If a set ofnobservations is normally distributed with varianceσ2and sample variances2, then ( n 1 ) s 2 σ 2 has a chi-square distribution with degrees of freedomν=n– 1。This relationship is used to calculate confidence intervals for the estimate of the normal parameterσ2in the functionnormfit

  • Student's t Distribution— The Student'stdistribution is a one-parameter continuous distribution that has parameterν(degrees of freedom). IfZhas a standard normal distribution andχ2has a chi-square distribution with degrees of freedomν, then t = Z χ 2 / ν has a Student'stdistribution with degrees of freedomν

  • Wishart Distribution— The Wishart distribution is a higher dimensional analog of the chi-square distribution.

References

[1] Abramowitz, Milton, and Irene A. Stegun, eds.Handbook of Mathematical Functions: With Formulas, Graphs, and Mathematical Tables。9. Dover print.; [Nachdr. der Ausg. von 1972]. Dover Books on Mathematics. New York, NY: Dover Publ, 2013.

[2] Devroye, Luc.Non-Uniform Random Variate Generation。New York, NY: Springer New York, 1986.https://doi.org/10.1007/978-1-4613-8643-8

[3] Evans, M., N. Hastings, and B. Peacock.Statistical Distributions。2nd ed., Hoboken, NJ: John Wiley & Sons, Inc., 1993.

[4] Kreyszig, Erwin.Introductory Mathematical Statistics: Principles and Methods。纽约:威利,1970年。

See Also

|||||

Related Topics