Risk ratio and odds ratio from a two by two table

Research updated on August 17, 2025
Cite: Biopharma Foundry. (2026, Month Day). Article title in italics. Article link
Author: Santhosh Ramaraj

You can compare two groups with a two by two table, then compute a risk ratio and an odds ratio to see how strongly an exposure relates to a binary outcome. The same table also gives you a risk difference, which describes change in absolute risk. These measures help you move from raw counts to a clear and practical summary. The example below uses an influenza vaccine study to show each step.

Why a two by two table is the right start

Cross tabulation lets you place exposure values in rows and outcomes in columns. This layout keeps the logic clean and the formulas consistent. When exposure sits in rows, you will read and report row percentages for a quick risk view within each group.

Notation that keeps the math tidy

Use d for the number who experienced the event and h for the number who did not. Use n for the group total, with subscripts one and zero for exposed and unexposed groups. Proportions are p = d, n, p1 = d1, n1, and p0 = d0, n0.

Layout for a two by two table

Exposure group Event present Event absent Total
Group one exposed d1 h1 n1
Group zero unexposed d0 h0 n0
Total d h n

Risk ratio odds ratio two by two table formulas

The primary keyword appears here to help search discovery and to signal the exact topic. You will see the formulas inside latex tags, which render cleanly in the visual editor. Keep exposure in rows and compute row percentages to avoid confusion.

Influenza vaccine example with real counts

During one influenza season, a trial enrolled four hundred sixty adults. Two hundred forty received vaccine, two hundred twenty received placebo. One hundred participants developed influenza, twenty in the vaccine group and eighty in the placebo group.

Fill the two by two table and add row percentages

Exposure group Influenza yes Influenza no Total Row percent with influenza
Vaccine 20 220 240 p_1 = \frac{20}{240} = 0.083\,
Placebo 80 140 220 p_0 = \frac{80}{220} = 0.364\,
Total 100 360 460 overall risk p = \frac{100}{460} = 0.217\,

With exposure in rows, row percentages let you compare risk within each exposure level. Vaccine shows about eight percent with influenza, placebo shows about thirty six percent with influenza. This already suggests a protective effect.

Compute the three core measures

Risk difference, absolute risk change

Risk difference compares event probabilities on the absolute scale. Positive values mean higher risk in the exposed group, values below zero mean lower risk in the exposed group. Formula and result for this example appear below.

\text{Risk difference} \,=\, p_1 \, − \, p_0
\text{Risk difference} \,=\, 0.083 \, − \, 0.364 \,=\, −0.281

You can read this as a reduction of about zero point two eight in absolute risk for the vaccine group. That equals twenty eight fewer cases per one hundred people compared with placebo. Absolute measures are helpful when you plan decisions that depend on actual case counts.

Risk ratio, relative risk

Risk ratio compares probabilities on a relative scale. Values below one show lower risk in the exposed group, values above one show higher risk. Here is the formula and the result.

\text{Risk ratio} \,=\, \frac{p_1}{p_0}
\text{Risk ratio} \,=\, \frac{0.083}{0.364} \,=\, 0.228

A value near zero point two three means the vaccine group had about twenty three percent of the risk seen in the placebo group. Put another way, risk was about seventy seven percent lower on a relative scale. Relative measures communicate effect strength across different baseline risks.

Odds ratio, a ratio of odds

Odds ratio compares odds, not probabilities. In a two by two table you can compute it from the cross product of the counts. See both forms below, they are algebraically the same.

\text{Odds ratio} \,=\, \frac{d_1, h_0}{d_0, h_1} \,=\, \frac{d_1, h_0}{d_0, h_1} \,=\, \frac{d_1, h_0}{d_0, h_1}
\text{Odds ratio} \,=\, \frac{d_1, h_0}{d_0, h_1} \,=\, \frac{20 \times 140}{80 \times 220} \,=\, 0.159

In this study the odds of influenza in the vaccine group were about sixteen percent of the odds in the placebo group. Odds ratio is common in case control studies and in logistic models. When the outcome is rare, odds ratio and risk ratio move close to each other.

How to choose among risk difference, risk ratio, and odds ratio

  • Use risk difference when decisions depend on counts, such as admissions avoided, events prevented, or patients affected.
  • Use risk ratio when you want a relative comparison that is easy to state to patients and to policy makers.
  • Use odds ratio when study design or modeling requires it, such as case control designs or logistic regression.

Remember that odds ratio can overstate the impression of effect when outcomes are common. In those settings, present both a relative measure and the absolute change side by side. This helps readers understand clinical impact.

Formulas you can copy into the editor

p = \frac{d}{n},\quad p_1 = \frac{d_1}{n_1},\quad p_0 = \frac{d_0}{n_0}

\text{Risk difference} = p_1 \, − \, p_0

\text{Risk ratio} = \frac{p_1}{p_0}

\text{Odds ratio} = \frac{d_1, h_0}{d_0, h_1} = \frac{d_1, h_0}{d_0, h_1} = \frac{d_1 / h_1}{d_0 / h_0}

From table to action, a short checklist

Build the two by two table

Put exposure in rows, outcomes in columns, and fill the four cells with counts.

Add row percentages

Compute risk within each row, this gives you p one and p zero at a glance.

Calculate measures

Compute risk difference, risk ratio, and odds ratio, then interpret both absolute and relative changes.

Report clearly

State the measure, the value, and the plain language meaning for readers who need the conclusion fast.

Also find out risk difference between two proportions.

Disclaimer: This article is for educational purposes only.