Maths Tool

Goodness of Fit Calculator

Evaluate categorical data with a clear goodness-of-fit workflow. Compare observed counts to expected patterns instantly. Review residuals, significance, assumptions, and decisions with confidence today.

Calculator Input

Enter category labels plus observed values. Then enter expected proportions or expected frequencies. The page will calculate chi-square, p-value, residuals, and decision.

Use one category name on each line.
Enter non-negative observed counts in matching order.
Use proportions like 0.25, percentages like 25, or raw expected counts.
Choose how expected values should be interpreted.
Choose the cutoff for your final decision.
Subtract fitted parameters from the default degrees of freedom.

Example Data Table

This sample uses four color categories with an equal expected split. It demonstrates how the calculator converts category differences into chi-square contributions.

Category Observed Expected Proportion Expected Count Contribution
Red180.25200.2000
Blue220.25200.2000
Green250.25201.2500
Yellow150.25201.2500
Total 80 1.00 80 2.9000

Formula Used

Chi-square goodness-of-fit statistic:

χ2 = Σ ((Oi - Ei)2 / Ei)

Here, Oi is the observed count and Ei is the expected count for category i.

Degrees of freedom: df = k - 1 - m

In this expression, k is the number of categories and m is the number of estimated parameters subtracted from the test.

Effect size: w = sqrt(χ2 / n)

This effect size helps describe the practical magnitude of deviation from the expected distribution.

How to Use This Calculator

  1. Enter each category label on its own line.
  2. Enter the observed frequency for every category in the same order.
  3. Choose whether expected entries are proportions or expected frequencies.
  4. Paste expected proportions, percentages, or frequencies in matching order.
  5. Select your significance level and add estimated parameters if needed.
  6. Press the calculate button to view the result above the form.
  7. Review chi-square, p-value, residuals, assumptions, and export buttons.

Frequently Asked Questions

1. What does this calculator test?

It tests whether observed categorical counts differ significantly from an expected distribution. The tool reports chi-square, p-value, degrees of freedom, residuals, and a decision using your chosen significance level.

2. Should I enter proportions or frequencies?

Use proportions or percentages when you know the target share for each category. Use expected frequencies when you already have raw expected counts. The calculator supports both methods.

3. Why are expected values rescaled sometimes?

Goodness-of-fit testing compares observed totals with matching expected totals. If your expected frequencies do not sum to the observed total, the calculator rescales them proportionally and shows a note.

4. What are standardized residuals?

Standardized residuals show which categories contribute most to the chi-square statistic. Larger absolute values indicate categories where observed counts differ more strongly from expectation.

5. What assumptions matter most?

Counts should be independent, categories should be mutually exclusive, and expected counts should usually be at least 5 in most cells. Very small expected counts can weaken the approximation.

6. What does the effect size mean?

Effect size w measures the practical strength of deviation from the expected distribution. Small p-values show significance, while w helps describe whether the difference is trivial or substantial.

7. When should estimated parameters be subtracted?

Subtract estimated parameters when the expected distribution was fitted from the same sample, such as when probabilities depend on parameters estimated from data. This adjusts degrees of freedom.

8. Can I export the results?

Yes. After calculation, you can download a CSV summary, create a PDF report, or print the result directly. The exported table includes the category-level calculations.

Related Calculators

F-Test Statistic CalculatorMultiple Regression Summary Calculatorsign test calculatorempirical rule calculatorroot mean square calculatorpoisson distribution calculatorcritical value calculatorspearman rank calculatorz table calculatorscatter plot 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.