6.7 Visualizing ORs

In addition to reporting the numeric results of a logistic regression, it is helpful to create a forest plot to visualize the AORs and their 95% CIs. You can easily create a forest plot using plot_model() from the sjPlot library (Lüdecke 2023). See ?plot_model for customization options.

Example 6.3 (continued): Create a forest plot displaying the AORs for the model. To put the AOR for age of first alcohol use on a similar scale as the categorical predictors, use the AOR and 95% CI for a 4-year difference in age (the interquartile range).

For the purpose of creating a forest plot, changing the age scale must be made via the method that transforms age prior to fitting the model (see Section 6.6.1). Using the interquartile range results in an AOR that compares the adjusted odds of the outcome between individuals at the 75th and 25th percentiles of the predictor distribution.

IQR(nsduh$alc_agefirst, na.rm=T)
## [1] 4
fpdat <- nsduh %>% 
  mutate(alc_agefirst4 = alc_agefirst/4)

fit.fp <- glm(mj_lifetime ~ alc_agefirst4 + demog_age_cat6 + demog_sex +
                     demog_income, family = binomial, data = fpdat)

# Use [-1,] to exclude the intercept since exp(intercept) is not an OR
CI <- exp(confint(fit.fp))[-1,]

The forest plot is shown in Figure 6.3.

# Forest plot
library(sjPlot)
plot_model(fit.fp,
           axis.lim = c(min(CI), max(CI)),
           auto.label = F)
Plot with one row for each predictor. In each row there is a point at that predictor's adjusted odds ratio and a line indicating the 95% confidence interval

Figure 6.3: Forest plot of AORs and their 95% CIs for the logistic regression analysis of lifetime marijuana use

References

———. 2023. sjPlot: Data Visualization for Statistics in Social Science. https://strengejacke.github.io/sjPlot/.