Chi-Square Test
GeneralPearson's Chi-Square Test
A statistical test that compares observed category counts against expected counts to determine whether a relationship between categorical variables (or a deviation from an expected distribution) is statistically real.
Definition
A chi-square test compares observed category counts against the counts you'd expect under some hypothesis ā either that a variable follows a specific expected distribution, or that two categorical variables are unrelated. Unlike a t-test, which compares means of continuous measurements, a chi-square test works with counts and frequencies of categories: how many customers chose each product option, how many defective items appeared in each production batch, and similar tallying questions.
The Chi-Square Test Calculator takes your observed and expected frequency pairs and computes both the chi-square statistic and its corresponding p-value.
Formula
ϲ = Ī£ [(Observed ā Expected)² Ć· Expected]
summed across every category (or cell, for a test of independence using a contingency table). The resulting statistic is compared against a chi-square distribution with the appropriate degrees of freedom to produce a p-value.
Worked Example
Testing whether a six-sided die is fair, after rolling it 60 times: expected count per face is 60 Ć· 6 = 10. Suppose observed counts were 8, 12, 9, 11, 7, 13 for faces 1 through 6. The chi-square statistic sums (8ā10)²/10 + (12ā10)²/10 + (9ā10)²/10 + (11ā10)²/10 + (7ā10)²/10 + (13ā10)²/10 = 0.4 + 0.4 + 0.1 + 0.1 + 0.9 + 0.9 = 2.8. With 5 degrees of freedom (6 categories ā 1), this modest chi-square value corresponds to a high p-value, meaning there's no strong evidence the die is unfair.
Key Things to Know
- Works with counts, not measurements: chi-square is for categorical/frequency data, while a t-test handles continuous numeric means.
- Two main forms: goodness-of-fit (one variable vs. an expected distribution) and test of independence (two variables' relationship via a contingency table).
- Degrees of freedom shape the comparison: more categories or a larger contingency table require a different reference distribution to judge significance.
- A low p-value signals a real deviation or relationship, not proof of the specific cause behind it.
- Expected counts should generally be at least 5 per category for the test's approximation to be reliable ā very sparse categories can distort results.
Related Calculators
Related Terms
Frequently Asked Questions