Overview
A chi-square test checks whether observed counts differ from what you'd expect, as in a goodness-of-fit test or a test of independence. This turns your chi-square statistic and degrees of freedom into a p-value.
Calculate the statistic first as the sum of (observed − expected)² ÷ expected. Enter it, the degrees of freedom and distribution code 3.
Worked examples
| Inputs | Result |
|---|---|
| Test Statistic9.35Degrees of Freedom3DistributionChi-squareTailsOne-tailedAlpha (%)5 | Distribution: chi-squareTest statistic: 9.35Degrees of freedom: 3p-value: 0.02Reject H0 at alpha=5% |
Show 2 more examples
| Test Statistic3.84Degrees of Freedom1DistributionChi-squareTailsOne-tailedAlpha (%)5 | Distribution: chi-squareTest statistic: 3.84Degrees of freedom: 1p-value: 0.05Fail to reject H0 at alpha=5% |
| Test Statistic12Degrees of Freedom4DistributionChi-squareTailsOne-tailedAlpha (%)5 | Distribution: chi-squareTest statistic: 12Degrees of freedom: 4p-value: 0.02Reject H0 at alpha=5% |
How it works
The p-value is the chance of a statistic this large if the null hypothesis were true. It comes from the chi-square distribution with your degrees of freedom. Degrees of freedom are categories − 1 for goodness of fit, or (rows − 1) × (columns − 1) for a contingency table.
The formula
| O, E | Observed and expected counts |
Practical tips
- 9.35 with 3 df gives p ≈ 0.025, significant at 5%. The 5% cutoff for 3 df is 7.81.
- Each expected count should be at least about 5 for the test to be reliable.
- You can check it in Excel with =CHISQ.DIST.RT(stat, df).
Frequently asked questions
What does a large chi-square mean?
The observed counts are far from the expected ones, so the null hypothesis looks unlikely.
Is chi-square one-tailed?
The test uses the upper tail only, so the tails setting doesn't matter here.
What if expected counts are small?
Combine categories, or use Fisher's exact test for 2 × 2 tables.