Chi Square Distribution

The chi square (χ2) distribution, also known as the chi-squared distribution, is a continuous probability distribution that models the distribution of the sum of the squares of n independent normal variables. It is widely used in hypothesis testing and confidence interval estimation for variance in statistics.

Definition

The chi square distribution is characterized by a single parameter, the degrees of freedom (n). While typically a positive integer, n can be any positive real number. The distribution is defined for all non-negative real values.

The probability density function (PDF) is given by:

f(x)=xn/21ex/2Γ(12n)2n/2

The cumulative distribution function (CDF) is:

F(x)=γ(n2,x2)Γ(n2)

where γ(s,x) is the lower incomplete gamma function and Γ(s) is the gamma function.

Applications

The chi-square distribution has numerous important applications in statistical analysis and quality control:

  • The distribution is fundamental in goodness-of-fit testing, where it helps determine whether sample data conforms to a hypothesized probability distribution.

  • In contingency table analysis, the chi-square test evaluates whether there is a significant relationship between categorical variables.

  • Statistical process control relies on chi-square distributions to establish confidence intervals for population variance, enabling effective quality monitoring in manufacturing.

  • When evaluating regression models, the chi-square test helps assess the goodness-of-fit of the model and validates underlying assumptions.

  • The distribution plays a crucial role in hypothesis testing for variance components in analysis of variance (ANOVA) procedures.

Properties

Statistical Properties
PropertyValue
Meann
Variance2n
Skewness8/n
Excess Kurtosis12/n
Entropyn/2+ln(2)+ln(Γ(n/2))+(1n/2)ψ(n/2)

The chi-square distribution has several notable properties:

  • The sum of independent chi-square variables is also chi-square distributed with degrees of freedom equal to the sum of the individual degrees of freedom.

  • For large n, the distribution approaches a normal distribution with mean n and variance 2n.

Relationships to Other Distributions

  • If Z is standard normal, then Z2 follows a chi-square distribution with 1 degree of freedom.

  • The chi-square distribution is a special case of the gamma distribution with shape α=n/2 and scale θ=2.

  • The ratio of two chi-square distributions divided by their respective degrees of freedom follows an F-distribution.

The ChiSquareDistribution Class

The chi square distribution is implemented by the ChiSquareDistribution class. It has one constructor which takes the degrees of freedom as its only argument. The following constructs a chi square distribution with 10 degrees of freedom:

C#
var chiSquare = new ChiSquareDistribution(10);

The ChiSquareDistribution class has one specific property, DegreesOfFreedom, that returns the degrees of freedom of the distribution.

ChiSquareDistribution has one static (Shared in Visual Basic) method, Sample, which generates a random sample using a user-supplied uniform random number generator.

C#
var random = new Pcg32();
double sample = ChiSquareDistribution.Sample(random, 10);

The above example uses the Pcg32 to generate uniform random numbers.

References

For more information on the chi-square distribution, refer to the following sources:

  • Johnson, N. L., Kotz, S., & Balakrishnan, N. (1994). "Continuous Univariate Distributions, Volume 1", Chapter 18. Wiley Series in Probability and Statistics.

  • Forbes, C., Evans, M., Hastings, N., & Peacock, B. (2011). "Statistical Distributions", Chapter 11. Wiley Series in Probability and Statistics.

See Also