Skip to main content
AI Platform ↗
07. Categorical Data Analysis & Contingency Tables8 min readAdvanced Lesson

Chi-Square, Fisher's Exact Test, Odds Ratios, and Relative Risk

Comparing observed versus expected frequencies, checking Cochran's cell-size rule, and interpreting 95% confidence intervals around OR and RR.

In this lesson you will learn

  • 1Calculate Expected cell frequencies (E = RowTotal × ColTotal / N) and apply Cochran's threshold (E < 5) to switch to Fisher's Exact Test.
  • 2Distinguish Odds Ratio (OR = ad / bc) for Case-Control studies from Relative Risk (RR) for prospective Cohort and RCT designs.
  • 3Evaluate statistical significance of OR and RR by checking whether the 95% Confidence Interval excludes 1.0, and apply McNemar's test to paired binary outcomes.
On this page▼
01

Contingency Table Anatomy & Risk Ratios

What this section is about

This section defines Expected Frequency (E), Pearson's Chi-Square, Fisher's Exact Test, Odds Ratio (OR), Relative Risk (RR), and McNemar's paired test.

Why it matters for your study

Reporting Relative Risk in a retrospective case-control study or reporting Pearson's Chi-square when an expected cell count is 2.1 are two of the most common categorical audit errors.

When both your exposure (e.g. Treatment vs Control) and your clinical endpoint (e.g. Remission vs Relapse) are categorical, observations are cross-tabulated in a contingency table:

Method / Metric Mathematical Formula When Required
Expected Count (E) E = (Row Total × Column Total) / Grand Total N Checked before choosing between Pearson χ² and Fisher's Exact test.
Fisher's Exact Test Exact hypergeometric probability across marginal totals. Required in 2×2 tables whenever any cell has E < 5 (Cochran's rule).
Odds Ratio (OR) (a / b) ÷ (c / d) = (a × d) / (b × c) Retrospective Case-Control studies and Binary Logistic Regression.
Relative Risk (RR) [a / (a + b)] ÷ [c / (c + d)] Prospective Cohort studies and Randomized Controlled Trials (incidence known).
McNemar's Test χ² = (b − c)² / (b + c) on discordant pairs. Paired binary outcomes measured Pre and Post on the same participants.
Event (+)No Event (-)ExposedControlabcdOdds Ratio (Case-Control)OR = (a × d) / (b × c)Relative Risk (Cohort / RCT)RR = [a/(a+b)] ÷ [c/(c+d)]
Figure:A 2×2 contingency table cross-tabulates exposure against outcome to compute Expected counts, Odds Ratios, and Relative Risks.

Clinical Example

A small surgical safety audit compares wound infection between Technique A (1 infection, 19 clean) and Technique B (7 infections, 13 clean); total N = 40.

Row totals = 20, 20 | Infection col total = 8 → Expected count in infection cells E = (20 × 8) / 40 = 4.0 (< 5)

Interpretation: Even though one observed cell is 7, the Expected count in both infection cells is 4.0 (< 5). Cochran's rule depends on Expected counts (not Observed counts), so Fisher's Exact Test (two-sided p = .044) is reported.

Common Pitfall

Checking Cochran's '< 5' rule against Observed cell counts (O) instead of Expected cell counts (E = RowTotal × ColTotal / N).

Advanced Chapter

Included with Any Analysez AI Study Package

This deep interactive chapter (Chi-Square, Fisher's Exact Test, Odds Ratios, and Relative Risk) and its clinical simulation labs are unlocked for everyone who has bought any Analysez AI study package.

Full unlock of all 10 advanced handbook modules & interactive labs
Interactive statistical models, sandbox data editors & live curve simulators
Publication-ready APA 7th Word table downloads & results templates
Full access to the Analysez AI automated 55-check data cleaning platform
Chi-Square, Fisher's Exact Test, Odds Ratios, and Relative Risk | Biostatistics Handbook | Analysez