Decision guide
Which Statistical Test Should I Use? (Categorical Data)
To test whether two categorical variables are related, use the chi-square test of independence — or Fisher's exact test for a small 2×2 table. Then report an effect size (Cramér's V or phi) for strength, and an ordinal measure(gamma, Kendall's tau, or Somers' d) if both variables are ordered.
Reviewed by the crosstabs.com methods team · Last updated
Run this on your own data — free, no signup
Upload a CSV or XLSX. Everything runs in your browser; your file never leaves your device.
Open the workspace →Are your variables categorical?
This guide is for categorical data — variables that sort observations into groups (e.g. treatment vs control, or low/medium/high), usually summarized in a cross-tabulation.
- If bothvariables are categorical, you're in the right place — keep reading to pick a test and an effect size.
- If onevariable is continuous (a number like age or income), a crosstab test isn't the right tool — you likely want a t-test, ANOVA, or correlation/regression instead.
Step 1 — Test for association
First ask whether there is any association at all between the two variables. Choose a significance test based on the size of your table and your expected counts:
- Two categorical variables, reasonable sample size → the chi-square test of independence.
- A small 2×2 table or low expected cell counts → use Fisher's exact test instead, since chi-square's approximation can be unreliable.
- Want a likelihood-ratio alternative to chi-square → the G-test.
Not sure which to pick? See chi-square vs Fisher's exact.
Step 2 — Measure strength (effect size)
A p-value tells you whether an association is real, not how strong it is. Always pair your test with an effect size:
- A 2×2 table → phi (φ) or Cramér's V (they are identical for 2×2).
- A larger table → Cramér's V, which stays bounded between 0 and 1.
- A chi-square-based alternative → the contingency coefficient.
For the difference between the two most common choices, see Cramér's V vs phi.
When to use it
Use it when
- Run a significance test (chi-square / Fisher / G-test) when you want to know IF two variables are associated.
Not the right tool when
- A p-value alone isn't enough — also report an effect size (Cramér's V, phi) to say HOW STRONG the association is.
How to interpret it
Rule of thumb
Significance tells you whether an association is real; effect size tells you whether it's big enough to matter — always report both.
Step 3 — If both variables are ordinal
When both variables have a natural order (e.g. low/medium/high), use a measure that accounts for that ordering rather than a nominal one:
- Goodman and Kruskal's gamma for the strength and direction of an ordinal association.
- Kendall's tau-b / tau-c, which adjust for ties and table shape.
- Somers' d when you want a directional/asymmetric measure (one variable predicts the other).
If you want a prediction-style (PRE) measure for nominal data
Proportional-reduction-in-error (PRE) measures tell you how much knowing one variable improves prediction of the other:
- Goodman & Kruskal's lambda for predicting the mode of one nominal variable from another.
- The uncertainty coefficient (Theil's U), an entropy-based PRE measure.
2×2 risk and effect
For a 2×2 table comparing an exposure or treatment against an outcome, you often want a measure of effect rather than just association:
- The odds ratio summarizes how the odds of the outcome change with exposure.
- To choose between an odds ratio and a risk ratio, see odds ratio vs risk ratio.
Frequently asked questions
- What test do I use for two categorical variables?
- Use the chi-square test of independence. For a small 2×2 table or low expected cell counts, use Fisher's exact test instead, then report an effect size such as Cramér's V or phi.
- What test for two ordinal variables?
- Use an ordinal measure of association: Goodman and Kruskal's gamma, Kendall's tau-b/tau-c, or Somers' d for a directional measure. These account for the ordering of categories, unlike chi-square.
- Do I need an effect size as well as a p-value?
- Yes. The p-value only tells you whether an association is statistically real; an effect size such as Cramér's V or phi tells you how strong it is. Always report both.
References & further reading
- Agresti, A. Categorical Data Analysis.
- Contingency table — Wikipedia
Try it on your own data — free, no signup
Upload a CSV or XLSX. Everything runs in your browser; your file never leaves your device.
Open the workspace →