3
$\begingroup$

I have a logistic regression in which most of the predictors are binary, but two are continuous (e.g., age). I am planning to use a simple forest plot to visualise the odds ratios for readers. However, because they are measured on different scales, the odds ratios for the continuous predictors look tiny in comparison to the odds ratios for the binary predictors (as an increase of 1 year of age of course leads to only a small increase in the probability of the outcome).

This gives the visual impression that age is an unimportant predictor, but it is not, for if we were to dichotomize age into a binary variable like the others (e.g. above/below the median) its odds ratio becomes large. What are best practices for clearly visualizing results for readers in this situation? It seems strange to put variables on different scales all on the same graph, but it also seems strange to dichotomize a variable solely for presentation purposes.

$\endgroup$

1 Answer 1

2
$\begingroup$

One good thing to do is to scale the predictors first, if the primary aim is to visualize the effects via odds ratio. You just need to note that the coefficients will change in odds ratio per unit of standard deviation per predictor.

Using an example dataset, in R, I make one predictor binary:

library(MASS)
library(sjPlot)
dat = Pima.tr
dat$npreg = as.numeric(dat$npreg>4)

Now fit and plot, I use a quick dot and whisker plot, strictly speaking not a forest plot because there's no tables etc:

mdl_unscaled = glm(type ~ .,data=dat,family="binomial")

summary(mdl_unscaled)

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept) -9.632097   1.770672  -5.440 5.33e-08 ***
npreg        0.901763   0.465648   1.937  0.05280 .  
glu          0.032334   0.006849   4.721 2.35e-06 ***
bp          -0.004198   0.018555  -0.226  0.82103    
skin        -0.007957   0.021949  -0.363  0.71695    
bmi          0.085720   0.042300   2.026  0.04271 *  
ped          1.895990   0.674502   2.811  0.00494 ** 
age          0.039695   0.021334   1.861  0.06279 .  

plot_models(mdl_unscaled)

enter image description here

The binary predictor npreg has a higher coefficient, and so does ped, altho from the c.i you can see they might not be that strong. So we can scale the data, and fit again:

dat[,2:6] = scale(dat[,2:6])
mdl_scaled = glm(type ~ .,data=dat,family="binomial")
plot_models(mdl_scaled)

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.