Making an odds ratio plot in R

infoart.ca
Aug 18, 2021

--

Given their ease of calculation and simplicity, odds ratios are used near universally in medical reporting. While many researchers still prefer the tabular format to report ORs, the odds ratio plots, or forest plots, have recently come into vogue. There are many ways to generate OR plot in R, but the one that I find to be most intuitive and least onerous is the ‘finalfit’ package.

Here is a quick demonstration:

install.packages("finalfit")
library(finalfit)

Load the colon_s dataset

data(colon_s)

Define the dependent and independent variables:

iv = c("age.factor", "sex.factor", "obstruct.factor")
dv = "mort_5yr"

now time to make the plot:

colon_s %>% 
or_plot(dv, iv)

Here is the quick and sweet output:

--

--

infoart.ca
infoart.ca

Written by infoart.ca

Center for Social Capital & Environmental Research | Posts by Bishwajit Ghose, BI consultant and lecturer at the University of Ottawa

No responses yet