Chi-Square Test Calculator
Run a chi-square test of independence on counts, or of goodness of fit, with Yates' correction, Fisher's exact test for 2 × 2 tables and Cramér's V.
Formula
- (rows − 1)(columns − 1) for a table; categories − 1 for goodness of fit
- effect size from 0 (no association) to 1 (complete)
How it works
A chi-square test compares observed counts with the counts expected if there were no association (or if the data followed the expected proportions). Large departures give a large χ², and so a small p-value. It applies to counts of independent observations, not to percentages or measurements.
The chi-square approximation is reliable only when expected counts are not small, commonly no more than a fifth of them below 5. For a 2 × 2 table with small counts, Fisher's exact test is preferred; Yates' continuity correction is an older adjustment that makes the test conservative. Cramér's V, which goes from 0 to 1, says how strong the association is, which the p-value does not.
Worked example
A 2 × 3 table: row 1 has 20, 15 and 30; row 2 has 10, 25 and 12.
- Expected counts: row 1 is 17.41, 23.21 and 24.38; row 2 is 12.59, 16.79 and 17.63.
- χ² = 10.937 with 2 degrees of freedom; p = 0.0042; V = 0.312.
The pattern across columns differs between the rows, with a moderate association (V = 0.31); all expected counts exceed 5.
These are the values the calculator opens with, so you can check its output against this example.
Assumptions
- Independent observations, each in exactly one cell.
- Expected counts not too small for the approximation.
- Counts, not proportions.
Common mistakes
- Entering percentages instead of counts.
- Using the chi-square approximation on sparse tables.
- Using it for paired or repeated data, where observations are not independent.