Odds Ratio

What is odd ratio ?

  • Odds ratio (OR) is statistical quantifier which measures the association between an exposure and an outcome. OR represents the odds of an outcome in present of particular exposure with comparison to odds in the absence of that exposure. In a simple definition you can how likely or probability of occurrence of an event in presence or absence of a particular exposure.
  • OR are mostly used in case control, cross sectional and cohort studies.

Where and When to use it?

  • OR is used to measure the relative odds of occurrence of an outcome especially disease or disorder in a given exposure. For an example, how likely the chance of occurrence of cancer in presence and absence of smoking as a factor.
  • OR can also be used to measure the risk factor for a particular outcome.

OR = 1 Exposure doesn’t affect the odds of outcome.

OR >1 Exposure associated with higher odds of outcome

OR <1 Exposure associated with lower odds of outcome

in rare outcomes OR = RR (relative risk) where the incidence of disease is < 10%

Then What is Confidence Interval (CI), which is always calculated with OR ?

  • 95% CI is used to estimate the precision of OR. A large CI indicates low level of precision for OR while a small CI indicates high precision of OR.
  • Remember, CI is not measure of statistical significance.
  • Its give you the range where your prediction will be in 95% of the time when you are estimating a population based on your sample. (CI is calculated with bootstrapping)

Now lets see, how you can calculate OR and CI using R :

Lets Say, There is a particular disease “X” and I want to check does it have any relationship with Demographic factor like Rural and Urban or simply does livelihood somehow effect the occurrence of the disease. So, I did sampling and collected information from both rural and urban population and it was like:

Positive Negative
Rural 65 55
Urban 46 34

So, all total I collected 200 people’s information, where 120 people were from rural area where 65 were found positive for the disease and 55 were negative. From urban I collected 80 samples and I found 46 were positive and 34 were negative for the disease. So, now lets do the OR test.

So, the question will be like what is the odds of having the disease for someone living in rural area and urban area ?

For this, I am going to use “epiR” package.


#Lets create a matrix of 2 by 2 and give the dataset a name of X
X <- matrix(c(65, 55, 46, 34), nrow = 2, byrow = TRUE)

     [,1] [,2]
[1,]   65   55
[2,]   46   34

#Lets chane the row names and colnames as according to the example
rownames(X) <- c(“Positive”, “Negative”)
colnames(X) <- c(“Rural”, “Urban”)

Rural Urban
Positive    65    55
Negative    46    34

#OR test
epi.2by2(X, method = “cohort.count”) (I used cohort count, here you can use Wald test or Fischer test accordingly)

             Outcome +    Outcome -      Total        Inc risk *        Odds
Exposed +           65           55              120              54.2                 1.18
Exposed -           46           34                80              57.5                 1.35
Total                    111           89               200             55.5                 1.25

Point estimates and 95 % CIs:
Inc risk ratio                                            0.94 (0.73, 1.21)
Odds ratio                                                 0.87 (0.49, 1.55)
Attrib risk *                                              -3.33 (-17.36, 10.70)
Attrib risk in population *                    -2.00 (-14.84, 10.84)
Attrib fraction in exposed (%)              -6.15 (-36.33, 17.34)
Attrib fraction in population (%)          -3.60 (-19.96, 10.52)
 X2 test statistic: 0.216 p-value: 0.642
 Wald confidence limits
 * Outcomes per 100 population units

interpretation : so the odds ratio tells us that the odds are 0.87 times great that someone living in rural areas will have X disease compare to urban areas. However, p value is above o.05 which indicate the results are not statistically significant.

You can even calculate the same in classical way by dividing odds of each case lets say:

chances or odds of having someone the disease living in rural area will be = 65/55 = 1.18

and similarly for someone living in urban area will be = 46/34 = 1.35

so the odds ratio will be = 1.18 / 1.35 = 0.87

For further Read: You can checkout,

Szumilas, M. (2010). Explaining odds ratios. Journal of the Canadian academy of child and adolescent psychiatry, 19(3), 227. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2938757/