Chi-Square Goodness of Fit Test

Advanced Statistical Tests

Enter the observed and expected frequencies to perform the test.

Examples

Explore some common use cases for the Chi-Square Goodness of Fit test.

Fair Dice Roll

dice

Testing if a six-sided die is fair after 180 rolls.

Observed: 25, 35, 28, 32, 29, 31

Expected: 30, 30, 30, 30, 30, 30

Alpha: 0.05

Mendelian Genetics

genetics

Checking if the observed phenotype ratio in pea plants (315 round/yellow, 101 round/green, 108 wrinkled/yellow, 32 wrinkled/green) matches the expected 9:3:3:1 ratio from 556 plants.

Observed: 315, 101, 108, 32

Expected: 312.75, 104.25, 104.25, 34.75

Alpha: 0.05

Customer Preference

market

A company claims that 40% of customers prefer product A, 30% prefer B, 20% prefer C, and 10% prefer D. A sample of 200 customers shows preferences of 85, 55, 45, and 15 respectively.

Observed: 85, 55, 45, 15

Expected: 80, 60, 40, 20

Alpha: 0.01

Uniform Distribution Test

uniform

Testing if the last digit of 100 random phone numbers is uniformly distributed.

Observed: 8, 11, 9, 12, 10, 10, 7, 13, 11, 9

Expected: 10, 10, 10, 10, 10, 10, 10, 10, 10, 10

Alpha: 0.10

Other Titles
Understanding the Chi-Square Goodness of Fit Test: A Comprehensive Guide
Learn how the Chi-Square Goodness of Fit test works, its applications, and how to interpret the results from this calculator.

What is the Chi-Square Goodness of Fit Test?

  • Core Concept
  • Null and Alternative Hypotheses
  • Key Assumptions
The Chi-Square (χ²) Goodness of Fit test is a non-parametric statistical hypothesis test used to determine how well an observed frequency distribution fits an expected frequency distribution. It's a fundamental tool for checking if your sample data is representative of a full population or if it conforms to a specific theoretical model.
Core Concept
The test compares the counts of categorical data you have collected (observed frequencies) against the counts you would expect to see if the null hypothesis were true (expected frequencies). By quantifying the difference between these observed and expected values, the test provides a single statistic—the Chi-Square value—which helps in making a decision about the hypothesis.
Null and Alternative Hypotheses
The hypotheses for a Goodness of Fit test are typically: Null Hypothesis (H₀): The sample data comes from the specified distribution. The observed frequencies match the expected frequencies. Alternative Hypothesis (H₁): The sample data does not come from the specified distribution. The observed frequencies do not match the expected frequencies.
Key Assumptions
For the test results to be valid, certain conditions should be met: The data must be categorical counts. The sample must be random. The expected frequency for each category should be at least 5. This is a common rule of thumb to ensure the Chi-Square distribution provides a good approximation.

Mathematical Derivation and Formula

  • The Chi-Square Formula
  • Degrees of Freedom (df)
  • P-value and Critical Value
The core of the test is the Chi-Square (χ²) formula, which measures the discrepancy between observed and expected frequencies.
The Chi-Square Formula
The formula is: χ² = Σ [ (Oᵢ - Eᵢ)² / Eᵢ ], where Oᵢ is the observed frequency and Eᵢ is the expected frequency for category i. The summation (Σ) is done over all categories. A larger χ² value indicates a greater difference between the observed and expected data, suggesting the null hypothesis might be false.
Degrees of Freedom (df)
Degrees of freedom represent the number of independent categories in the test. It is calculated as: df = k - 1, where 'k' is the number of categories. It determines the shape of the Chi-Square distribution used to find the p-value.
P-value and Critical Value
The p-value is the probability of observing a Chi-Square statistic as extreme as, or more extreme than, the one calculated from the sample data, assuming the null hypothesis is true. A small p-value (typically ≤ α) leads to rejecting the null hypothesis. The critical value is a threshold from the Chi-Square distribution. If your calculated χ² statistic is greater than the critical value, you reject the null hypothesis.

Step-by-Step Guide to Using the Calculator

  • Entering Observed Frequencies
  • Entering Expected Frequencies
  • Interpreting the Results
1. Entering Observed Frequencies
In the 'Observed Frequencies' field, input the counts you have collected for each category. Ensure the numbers are separated by commas. For example, if you rolled a die 60 times and got ten 1s, twelve 2s, etc., you would enter '10, 12, 8, 11, 9, 10'.
2. Entering Expected Frequencies
In the 'Expected Frequencies' field, enter the counts you would expect for each category according to your null hypothesis. For a fair die rolled 60 times, you would expect ten of each outcome, so you would enter '10, 10, 10, 10, 10, 10'. The number of entries must match the observed frequencies.
3. Setting the Significance Level (α)
Choose a significance level from the dropdown menu. This is your threshold for statistical significance. A common choice is 0.05 (or 5%).
4. Interpreting the Results
After clicking 'Calculate', the tool will display the Chi-Square statistic, degrees of freedom, p-value, and a clear conclusion. If the p-value is less than your chosen α, the conclusion will state that the difference is statistically significant, and you should reject the null hypothesis.

Real-World Applications of the Test

  • Genetics and Biology
  • Manufacturing and Quality Control
  • Marketing and Consumer Behavior
Genetics and Biology
Scientists use the Goodness of Fit test to check if their observed results from genetic crosses match the theoretical ratios predicted by Mendelian inheritance. For example, testing if the offspring of a dihybrid cross exhibit the expected 9:3:3:1 phenotypic ratio.
Manufacturing and Quality Control
A factory might use the test to determine if the number of defective items produced each day of the week is uniformly distributed. If one day has significantly more defects, it could indicate a problem with the process on that specific day.
Marketing and Consumer Behavior
A market researcher can use the test to see if the distribution of people who prefer a certain product matches the demographic distribution of the city. This helps to understand if the product appeals to a specific segment of the population more than others.

Common Misconceptions and Correct Methods

  • Confusing with Test of Independence
  • The 'Expected Count' Rule
  • Correlation vs. Causation
Confusing with Chi-Square Test of Independence
A common mistake is confusing the Goodness of Fit test with the Chi-Square Test of Independence. The Goodness of Fit test compares a single categorical variable to a known distribution, while the Test of Independence assesses whether two categorical variables are related to each other.
The 'Expected Count' Rule
The rule that all expected counts should be 5 or more is a guideline, not a strict law. When this assumption is violated, especially with very small counts, the Chi-Square approximation may be inaccurate. In such cases, other tests like Fisher's Exact Test might be more appropriate, though that is typically used for 2x2 contingency tables.
Correlation vs. Causation
Even if the test shows that the data does not fit the expected model (a statistically significant result), it does not explain why. The Chi-Square test reveals a discrepancy but does not imply causation. Further investigation is always needed to understand the underlying reasons for the difference.