Statistics and research

Chi-square goodness-of-fit calculator

Test whether observed category counts fit equal or specified expected proportions, with each category’s contribution and residual.

Runs in your browser. What you enter stays on this page and is not uploaded.

One count per category, in order.
Same order and number as the observed counts; they are rescaled to sum to 1. Leave blank for equal proportions.
Reduces the degrees of freedom (for example 1 when fitting a Poisson mean).

Results

χ²9.99014df4p-value0.04059
Chi-square Σ(O − E)² / E
9.9901434
Degrees of freedom k − 1 − estimated parameters
4
p-value
0.04059
Total count
186
Expected proportions
As entered, rescaled to sum to 1
Conclusion
The counts differ from the expected distribution (significant at the 5% level).
Observed and expected counts
CategoryObservedExpected(O − E)² / EPearson residual
Category 18974.42.865051.693
Category 23737.20.00107527-0.03279
Category 33037.21.39355-1.18
Category 42827.90.0003584230.01893
Category 529.35.73011-2.394

Method and limits

How to use it

Enter the observed count for each category. Leave the expected box blank to test equal proportions, or enter the expected proportions, percentages or counts in the same order — they are rescaled to sum to 1. If you estimated parameters from the same data (for example a Poisson mean), enter how many.

Formulas

  • Expected count Ei = n × pi.
  • χ² = Σ (Oi − Ei)² / Ei with k − 1 − m degrees of freedom (k categories, m estimated parameters); p is the right tail.
  • Pearson residual (O − E) / √E shows which categories deviate most.

Assumptions and limits

  • Independent observations, each in one category; counts, not percentages.
  • Expected counts of 5 or more in most categories; combine sparse categories otherwise.
  • For two categories this is equivalent to a z-test of one proportion; for exact small-sample answers use a binomial or multinomial exact test.

Worked example

R’s example: observed 89, 37, 30, 28, 2 against proportions 40 : 20 : 20 : 15 : 5. Expected counts are 74.4, 37.2, 37.2, 27.9 and 9.3; χ² = 9.990 with 4 df, p = 0.0406. The last category (2 observed, 9.3 expected) contributes most.

References

Related tools

Share this page

Remind me to visit Contifield

Adds a repeating reminder to your calendar, titled “Contifield Reminder: Visit www.contifield.com”.