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 / b

Odds Group 2

odds_group2 = c / d

Variables

VariableDescriptionDefault
aGroup 1 - Event (a)30
bGroup 1 - No Event (b)70
cGroup 2 - Event (c)15
dGroup 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:

  • a = exposed cases, b = exposed non-cases
  • c = unexposed cases, d = unexposed non-cases
  • 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
    1. 01Odds Group 1 = 30/70 = 0.4286
    2. 02Odds Group 2 = 15/85 = 0.1765
    3. 03OR = (30*85) / (70*15) = 2550 / 1050 = 2.4286
    4. 04ln(OR) = ln(2.4286) = 0.887
    5. 05The odds of the event are 2.43 times higher in Group 1

    Ready to run the numbers?

    Open Odds Ratio Calculator