Chi-Squared Test and Fisher Exact Test
Core summary
These tests compare proportions and categorical variables using a contingency table. Chi-square works for larger samples; Fisher's exact test is used when expected cell counts are small.
Detailed explanation
Detailed explanation
When both variables are categorical, for example treatment (drug or placebo) versus outcome (cured or not), you compare proportions using a contingency table, often a 2x2 table. The chi-square test of independence asks whether the observed cell counts differ from what you would expect if the two variables were unrelated. A small p-value suggests an association, for instance that the cure rate differs by treatment. The key assumption is sample size: the chi-square approximation becomes unreliable when expected counts are small. A common rule is that each expected count should be at least 5. When cells are sparse, in small studies or with rare outcomes, use Fisher's exact test, which computes the exact probability directly instead of relying on the approximation. For 2x2 tables Fisher's exact test is always valid, and many people use it by default for small tables. Report more than the p-value. Give the actual counts and proportions, and an effect measure, a risk ratio, odds ratio, or risk difference, so readers see the size of the association, not merely its presence. For paired categorical data, for example the same patients tested with two methods, use McNemar's test rather than the ordinary chi-square. Pitfalls: applying chi-square with tiny expected counts (use Fisher instead); treating a significant chi-square as proof of causation when it only shows association; carelessly collapsing categories; and forgetting that very large samples can make trivial associations 'significant'. A practical workflow helps: build the contingency table, check the expected counts, then choose chi-square or Fisher accordingly. For a 2x2 table the most useful companion numbers are the two group proportions and an odds ratio or risk ratio with a confidence interval, which convert a bare 'significant association' into something a clinician can weigh. When the same patients are classified twice, for example two diagnostic tests on each person, switch to McNemar's test, which is built for that paired structure.
Clinical example
A 2x2 table of vaccine (yes or no) versus influenza (yes or no) in 400 people is analyzed with a chi-square test and reported with the attack rates and a risk ratio.
Research example
A small surgical study (n=28) compares complication rates between two techniques; several expected counts fall below 5, so Fisher's exact test is used instead of chi-square.
Knowledge check
Q1. Two categorical variables in a large sample are best compared with which test?
Q2. Several expected counts in a 2x2 table are below 5. Which test should you use?
Q3. A significant chi-square test demonstrates: