How this calculator works
- Step 1ExpectedEFrom shares, or row × column ÷ total.
- Step 2StatisticΣ (O − E)² ÷ EHow far counts are from E.
- Step 3p-valueχ² tailWith the right degrees of freedom.
A chi-square test asks whether observed counts are close enough to the counts you would expect if the null hypothesis were true. Big gaps, relative to the expected counts, make χ² large.
For goodness of fit the expected counts come from the shares you give. For independence they come from the table’s row and column totals.
Worked example: OpenStax Example 11.2
- χ²
Σ (O − 12)² ÷ 12
- Expected per day60 ÷ 512
- Contributions9/12 + 0 + 9/12 + 9/12 + 9/123
- Degrees of freedom5 − 14
- p-value0.5578
OpenStax gives χ² = 3 and p = 0.5578: no evidence that absences depend on the day.
Read the result
- Streaming services (11.3)p = 0.000006χ² = 29.6464: the region differs from the nation.
- Volunteers (11.6)p = 0.0113χ² = 12.9909 on a 3 × 3 table.
A small p-value says the counts do not fit the expectation; it does not say which categories differ. Compare observed and expected counts for that.
Assumptions and limits
- CountsUse frequencies, not percentages, for observed data.
- Expected ≥ 5Small cells make the p-value unreliable.
- IndependentEach observation counted once.
- Upper tailChi-square tests are right-tailed.
Related statistics tools
Chi-square tests counts in categories. Means and test statistics have their own tools.
To compare two sample means, use the t-test calculator. The p-value calculator converts z or t statistics, and the sample size calculator plans how much data you need.
Common mistakes
Mistake: Entering percentages as observed values.
Instead: Enter the counts themselves.
Mistake: Using rows − 1 for a table’s df.
Instead: Use (rows − 1)(columns − 1).
Checking the method
A separate script recomputes each statistic in exact fractions and the tail with a closed form or numerical integration, reproducing OpenStax Examples 11.2, 11.3 and 11.6.
Read how we test our calculators, or browse more maths calculators.