Chi-Square Goodness-of-Fit Test

Chi-square goodness-of-fit test comparing observed counts to an expected distribution.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter observed counts and, optionally, expected counts. Leave expected blank to test against equal frequencies. The tool reports χ², df, p and Cohen's w.

How to use

1
Step 1
Enter the observed counts.
2
Step 2
Enter expected counts, or leave blank for uniform.
3
Step 3
Add extra estimated parameters if any and press Calculate.

How it works

The test compares observed counts with those a hypothesis predicts: Σ(O − E)² ÷ E. df is categories − 1 − estimated parameters. A low-count warning appears when expected counts are too small for the chi-square approximation to be trustworthy.

χ² = Σ (O − E)² ÷ E      df = k − 1 − (parameters estimated)

Worked example

Is the die fair?

Input
Observed 5, 8, 9, 8, 10, 20 (n = 60)
Output
χ²(5) = 13.40, p = .020, w = 0.47
Walkthrough
Expected 10 each. (25 + 4 + 1 + 4 + 0 + 100) ÷ 10 = 13.4. The right-tail p for 13.4 on 5 df is.0199.

Limitations

  • Counts, not percentages.
  • Expected counts under about 5 make the p-value unreliable.

Questions

How do I test a die for fairness?
Enter the six counts and leave expected blank; the expected count is n ÷ 6.
What does 18, 22, 20, 19, 21 give?
χ²(4) = 0.50, p =.974: very consistent with equal frequencies.
How many degrees of freedom?
Categories minus one, minus any parameters estimated from the data.

Features

  • Uniform or custom expected
  • Cohen's w
  • Low-count warning

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Student's t-distribution

    Khan Academy

    Why t-tables differ from z for small samples.

    Watch on YouTube
  • Hypothesis testing and p-values

    StatQuest with Josh Starmer

    Intuition for t/z/χ² decision rules.

    Watch on YouTube