Not every relationship is between numbers. Plan tier by gender, churn by region, response by campaign — both sides are categories, so there's no average to compare. The chi-square test of independence is built for exactly this: deciding whether two categorical variables are related or just coincidentally lined up.
Note
The Contingency Table
The data goes into a cross-tab: rows for one variable, columns for the other, counts in the cells.
| Observed | Plan A | Plan B |
|---|---|---|
| New users | 120 | 80 |
| Returning users | 60 | 140 |
At a glance, new users lean to Plan A and returning users to Plan B. The question is whether that pattern is real or the kind of split you'd see by chance.
Observed vs Expected
The test computes the counts you'd expect in each cell if the two variables were independent — based only on the row and column totals — and compares them to what you observed, as the bars in the figure above contrast.
| Cell | Observed | Expected if independent |
|---|---|---|
| New · Plan A | 120 | 90 |
| New · Plan B | 80 | 110 |
| Returning · Plan A | 60 | 90 |
| Returning · Plan B | 140 | 110 |
The chi-square statistic sums the squared gaps between observed and expected, scaled by expected. Large gaps push the statistic up and the p-value down — evidence the variables move together.
Reading the Result
- A small p-value means the variables are related — the observed counts differ from independence more than chance would explain
- The chi-square statistic itself grows with the size of the observed-expected gaps
- Effect size (Cramér's V) tells you how strong the relationship is, not just whether it exists
Tip
Assumptions and Limits
- Independent observations — each person or record counted once
- Adequate expected counts — a common rule is expected ≥ 5 in most cells
- Counts, not percentages — chi-square works on raw frequencies
- It shows association, not direction or cause
Watch out
Chi-square in the SKARI Statistical Lab
SKARI's Statistical Lab runs the crosstab and chi-square together: pick two categorical variables and it builds the table, computes observed vs expected, and reports the test with an effect size.
- Crosstab (contingency table) construction from two categorical columns
- Chi-square statistic, degrees of freedom, and p-value
- Expected-count check with a Fisher's exact fallback for small cells
- Cramér's V effect size and a plain-language read of the relationship
Takeaway
Frequently Asked Questions
What if my cells have tiny counts?
Chi-square gets unreliable below expected counts of about 5. Use Fisher's exact test, which SKARI offers as a fallback.
Does chi-square tell me the direction?
No — it flags that a relationship exists. Read the table cells (or standardized residuals) to see which combinations drive it.
Chi-square or correlation?
Chi-square for two categorical variables; correlation for two numeric ones. They answer the same 'are these related?' question for different data types.
Key Takeaways
For
Categories
not means
Compares
Obs vs Exp
if independent
Small p
Related
beyond chance
Strength
Cramér V
effect size
The chi-square test turns a cross-tab of counts into a clear verdict on whether two categories are linked. Check the expected counts, read significance with an effect size, and remember it shows association, not cause.
Takeaway
Hypothesis Testing Basics
The framework behind the test
Correlation ≠ Causation
Related isn't caused
Confidence Intervals
The range behind an estimate