Chi-Square Test of Independence
VerifiedCategorical
Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.
Loading teaching datasets…
Or use your own dataset
Loading your datasets…
Omnibus test of association between two categorical variables in an r × c contingency table.
Compares observed cell counts to those expected under independence (row_i × col_j / N) via χ² = Σ (O − E)² / E with df = (r−1)(c−1). Reports the χ² statistic, p, Cramér's V effect size, and per-cell standardised residuals to localise WHERE the association lives. The engine auto-checks Cochran's expected-count rule (all expected ≥ 1, ≤ 20% < 5) and routes to Fisher's exact / Monte-Carlo p when violated.
Worked example
Is smoking status associated with regular exercise?
300 adults were cross-classified by smoking (yes/no) and regular exercise (yes/no); a chi-square test of independence checks for association.
Smoking and exercise were associated, χ²(1, N = 300) = 22.2, p < .001, φ = .27 — smokers were less likely to exercise regularly.
A chi-square test showed a significant association between smoking and regular exercise, χ²(1, N = 300) = 22.2, p < .001, φ = .27.
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- Two nominal / categorical variablesA political poll crosses respondent education level (4 categories) with party preference (5 parties).
- Test of homogeneity (same distribution across groups)Three regional samples (n = 200 each) are surveyed on political preference (5 parties).
When NOT to — use instead
- Paired categorical (same subjects measured twice)χ² requires INDEPENDENT subjects in cells. → McNemar's Test (paired 2\u00d72)
- Continuous DV with categorical predictorχ² is for two categorical variables. → One-Way ANOVA (3+ groups)
- Sparse table with expected counts < 5Cochran's rule violated → asymptotic χ² inflates Type-I. → Fisher's Exact Test
- Ordered categorical predictor with binary outcomeWhen the predictor IS ordinal (e.g., dose level), Cochran-Armitage trend is more powerful for monotone-trend hypotheses. → Cochran-Armitage Trend Test
Hypotheses
Parameter tested: joint distribution P(row, col)
Assumptions (and what to do if they fail)
Check: Count cells with expected count < 5 and report the minimum expected count.
If violated: Sparse tables inflate the χ² Type I error rate.
Check: Note whether either variable is ordinal.
If violated: Treating an ordered variable as nominal loses power.
Ready to run a Chi-Square Test of Independence on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →