Chi-Square Goodness of Fit Calculator

Test categorical distributions using flexible expected-value options. See p-values, degrees of freedom, residuals, and diagnostics. Download reports quickly and compare observed patterns with confidence.

Calculator

Category Observed Frequency Expected Count Expected Probability Remove

Example Data Table

Category Observed Expected Probability Expected Count
Red 52 0.25 37.50
Blue 43 0.25 37.50
Green 31 0.25 37.50
Yellow 24 0.25 37.50

This example tests whether four categories follow an equal theoretical distribution.

Formula Used

Chi-square statistic: χ² = Σ ((O − E)² / E)

Degrees of freedom: df = k − 1 − m

Expected count from probability: E = N × p

Effect size: w = √(χ² / N)

O is the observed frequency. E is the expected frequency. k is the number of categories. m is the number of estimated parameters. N is the total sample size.

How to Use This Calculator

  1. Choose whether your expectations are entered as probabilities, counts, or equal proportions.
  2. Enter each category name and its observed frequency.
  3. Fill expected counts or probabilities when the selected mode requires them.
  4. Set alpha, decimal places, and the number of estimated parameters if needed.
  5. Submit the form to see the chi-square statistic, p-value, decision, residuals, and effect size.
  6. Review assumption notes. Small expected counts may weaken the approximation.
  7. Use the export buttons to download CSV and PDF reports.

About This Test

The chi-square goodness of fit test checks whether a categorical sample matches a theoretical distribution. It compares observed frequencies with expected frequencies and measures the gap using a summed standardized distance. Larger test statistics show stronger disagreement between the model and the data.

This page supports three common workflows. You can enter direct expected counts, work from expected probabilities, or test equal proportions across all categories. The probability option is useful when a theory gives percentages. The count option is useful when a benchmark table already exists.

The calculator also subtracts estimated parameters from the degrees of freedom. That matters when your expected distribution was partly estimated from the same data. Residuals and category-level contributions identify which categories drive the final chi-square statistic. Effect size helps you judge practical importance beyond simple significance.

Always inspect expected counts before trusting the approximation. When some categories are sparse, combine meaningful groups or use an exact alternative when appropriate. The included graph makes it easier to compare observed and expected patterns visually before reporting your conclusion.

FAQs

1. What does this test evaluate?

It checks whether observed category frequencies match a specified theoretical distribution. The null hypothesis says the sample follows the expected pattern.

2. Can I use expected probabilities instead of counts?

Yes. Enter probabilities for each category. The calculator converts them into expected counts by multiplying each probability by the total observed sample size.

3. Why do expected counts matter?

Expected counts determine the denominator in each chi-square contribution. Very small expected counts can make the approximation unstable and weaken interpretation.

4. What if my probabilities do not sum to one?

The calculator normalizes them automatically and adds a note. This keeps the model coherent and matches the observed sample total.

5. What are standardized residuals for?

They show which categories differ most from expectation. Large positive values mean more cases than expected. Large negative values mean fewer cases than expected.

6. Why subtract estimated parameters from degrees of freedom?

If the expected distribution was estimated from the same sample, the model used information from the data. Subtracting parameters adjusts the test accordingly.

7. What does effect size w mean?

It summarizes the overall strength of the mismatch between observed and expected distributions. It complements the p-value with a practical magnitude measure.

8. Does rejecting the null hypothesis prove the theory is useless?

No. It only shows that the sample distribution differs from the stated expectation. The difference may be small, meaningful, or caused by model misspecification.

Related Calculators

Mann-Whitney U Test CalculatorKruskal-Wallis H Test CalculatorKendall Tau Correlation CalculatorSign Test CalculatorKolmogorov-Smirnov One Sample Test CalculatorKolmogorov-Smirnov Two Sample Test CalculatorJonckheere-Terpstra Trend Test CalculatorMcNemar Test CalculatorFisher Exact Test CalculatorBinomial Sign Test Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.