Odds Ratio Calculator Formula
Understand the math behind the odds ratio calculator. Each variable explained with a worked example.
Formulas Used
Odds Ratio (OR)
odds_ratio = (a * d) / (b * c)ln(OR)
log_or = log((a * d) / (b * c))Odds Group 1
odds_group1 = a / bOdds Group 2
odds_group2 = c / dVariables
| Variable | Description | Default |
|---|---|---|
a | Group 1 - Event (a) | 30 |
b | Group 1 - No Event (b) | 70 |
c | Group 2 - Event (c) | 15 |
d | Group 2 - No Event (d) | 85 |
How It Works
How to Calculate the Odds Ratio
Formula
OR = (a * d) / (b * c)
where a, b, c, d are cells of the 2x2 table:
OR = 1 means no association. OR > 1 means the exposure increases the odds of the outcome. OR < 1 means the exposure is protective.
Worked Example
Group 1: 30 events, 70 non-events. Group 2: 15 events, 85 non-events.
a = 30b = 70c = 15d = 85
- 01Odds Group 1 = 30/70 = 0.4286
- 02Odds Group 2 = 15/85 = 0.1765
- 03OR = (30*85) / (70*15) = 2550 / 1050 = 2.4286
- 04ln(OR) = ln(2.4286) = 0.887
- 05The odds of the event are 2.43 times higher in Group 1
Ready to run the numbers?
Open Odds Ratio Calculator