Home Â» How to Calculate Odds Ratio and Relative Risk in Excel

# How to Calculate Odds Ratio and Relative Risk in Excel

We often use theÂ odds ratioÂ andÂ relative riskÂ when performing an analysis on a 2-by-2 table, which takes on the following format:

The odds ratioÂ tells usÂ the ratio of the odds of an event occurring in a treatment group to the odds of an event occurring in a control group. It is calculated as:

Odds ratioÂ = (A*D) / (B*C)

TheÂ relative riskÂ tells us the ratio of the probability of an event occurring in a treatment group to the probability of an event occurring in a control group. It is calculated as:

Relative riskÂ = [A/(A+B)]Â  /Â  [C/(C+D)]

This tutorial explains how to calculate odds ratios and relative risk in Excel.

### How to Calculate the Odds Ratio and Relative Risk

Suppose 50 basketball players use a new training program and 50 players use an old training program. At the end of the program we test each player to see if they pass a certain skills test.

The following table shows the number of players who passed and failed, based on the program they used:

The odds ratioÂ is calculated as (34*11) / (16*39) =Â 0.599

We would interpret this to mean that the odds that a player passes the test by using the new program are justÂ 0.599 times the oddsÂ that a player passes the test by using the old program.

In other words, the odds that a player passes the test are actually lowered by 40.1% by using the new program.

TheÂ relative riskÂ is calculated asÂ  [34/(34+16)]Â  /Â  [39/(39+11)] =Â 0.872

We would interpret this to mean that the ratio of the probability of a player passing the test using the new program compared to the old program isÂ 0.872.

Because this value is less than 1, it indicates that the probability of passing is actually lower under the new program compared to the old program.

We could also see this by directly computing the probability that a player passes under each program:

Probability of passing under new program = 34 / 50 =Â 68%

Probability of passing under old program = 39 / 50 = 78%

### How to Calculate Confidence Intervals

Once we calculate the odds ratio and relative risk, we may also be interested in computing confidence intervals for these two metrics.

A 95% confidence interval for the odds ratio can be calculated using the following formula:

95% C.I. for odds ratio = [ e^(ln(OR) â€“ 1.96*SE(ln(OR))),Â  e^(ln(OR) â€“ 1.96*SE(ln(OR))) ]

where SE(ln(OR)) =âˆš1/A + 1/B + 1/C + 1/D

The 95% C.I. for the odds ratio turns out to be (.245, 1.467). The image below shows the formula we used to calculate this confidence interval:

A 95% confidence interval for the relative riskÂ can be calculated using the following formula:

95% C.I. for relative risk = exp(ln(RR) â€“ 1.96*SE(ln(RR))) toÂ exp(ln(RR) â€“ 1.96*SE(ln(RR)))

where SE(ln(RR)) =âˆš1/A + 1/C â€“ 1/(A+B) â€“ 1/(C+D)

The 95% C.I. for the relative risk turns out to be (.685, 1.109). The image below shows the formula we used to calculate this confidence interval: