Chi-Square Goodness-of-Fit Test: Step-by-Step Guide

Your ultimate resource for statistical tests and tools

What is a Goodness-of-Fit Test?

A goodness-of-fit test is used in statistics to determine whether a sample data set matches an expected distribution. It is particularly helpful in assessing how well observed frequencies align with theoretical predictions. One of the most commonly used types is the Chi-Square Goodness-of-Fit Test.

Chi-Square distribution graph

Understanding the Chi-Square Goodness-of-Fit Test

The Chi-Square Goodness-of-Fit Test evaluates how well categorical data matches expectations. The null hypothesis (H₀) states that the observed distribution fits the expected distribution, while the alternative hypothesis (H₁) suggests a significant difference exists.

The test statistic is calculated as:

χ² = Σ (Oᵢ - Eᵢ)² / Eᵢ
    

Where Oᵢ is the observed frequency, and Eᵢ is the expected frequency.

Real-World Example: Candy Color Distribution

Suppose a candy manufacturer claims that its bags contain colors in the following percentages: Red (30%), Blue (25%), Green (20%), Yellow (15%), and Orange (10%). A quality check on 100 candies yields: Red: 32, Blue: 28, Green: 19, Yellow: 11, Orange: 10.

Candy color chart

Step-by-Step Calculation

Expected values based on 100 candies: Red 30, Blue 25, Green 20, Yellow 15, Orange 10.

χ² = (32-30)²/30 + (28-25)²/25 + (19-20)²/20 + (11-15)²/15 + (10-10)²/10 = 1.61

With 4 degrees of freedom, the critical value at α = 0.05 is 9.488. Since 1.61 < 9.488, we fail to reject the null hypothesis. Thus, the observed distribution aligns with expectations.

Try It Yourself: Use the Online Calculator

Easily calculate your own Chi-Square Goodness-of-Fit values using the embedded calculator below. You can also open it in a new tab.

Statistical calculator interface preview

Why This Matters

Goodness-of-fit tests help analysts, marketers, scientists, and engineers validate theoretical models using real-world data. Whether you're testing genetic distributions, product quality, or survey results, the Chi-Square test provides a clear and reliable approach.

Conclusion

The Chi-Square Goodness-of-Fit Test is an essential part of any statistician’s toolkit. This article not only explained its purpose and calculation but also demonstrated its real-world application. Use the calculator provided to apply these principles to your own data.