Course contentsShow
← Mathematics
Lesson 3043 of 3,12159. Statistics — Descriptive and InferentialFree lesson

Chi-Squared Goodness-of-Fit Test

Test whether observed frequency data matches an expected theoretical distribution using the chi-squared statistic.

Chi-Squared Goodness-of-Fit Test

What you'll learn: You'll learn how to test whether your observed data follows a theoretical distribution using the chi-squared statistic.

The Core Idea

Imagine you roll a die 60 times and wonder: "Is this die fair?" You expect each face to appear 10 times (60 rolls ÷ 6 faces), but you observe something like: 12, 8, 11, 9, 13, 7. Are these differences just random variation, or is the die biased?

The chi-squared goodness-of-fit test answers this question by comparing observed frequencies with expected frequencies under a theoretical distribution.

How It Works

The test uses the chi-squared statistic:

χ2=∑i=1k(Oi−Ei)2Ei\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}

where:

  • O_i = observed frequency in category i
  • E_i = expected frequency in category i under your theoretical model
  • k = number of categories

The logic: If observed and expected frequencies are close, each term (O_i - E_i)²/E_i is small, making χ² small. Large χ² values suggest the data doesn't fit the theoretical distribution well.

The Testing Process

  1. State hypotheses: H₀: Data follows the theoretical distribution vs. H₁: It doesn't
  2. Calculate expected frequencies from your theoretical model
  3. Compute the χ² statistic using the formula above
  4. Find degrees of freedom: df = k - 1 - (number of estimated parameters)
  5. Compare your χ² to the chi-squared distribution with df degrees of freedom
  6. Decide: If the p-value is small (< significance level), reject H₀

Requirements

  • Expected frequencies should be at least 5 in each category
  • Categories must be mutually exclusive and exhaustive
  • Observations must be independent

Key Takeaway: The chi-squared goodness-of-fit test quantifies how well observed categorical data matches a theoretical distribution by measuring squared deviations relative to expected frequencies.