1

I am using glmer to create a hierarchical mixed model, and plot_model to display the results as a forest plot.

hmdl <- glmer(asww ~ bwo + dx_year + psadx + agedec + (1 | practiceid/npi),
              data = mdata, family = binomial(link = "logit"), control = glmerControl(optimizer = "Nelder_Mead"))

plot_model(hmdl, title = "Predictors of active surveillance", axis.labels=labels, 
           group.terms = c(1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4),
           axis.lim = c(0.7,4), colors="Set1")

It all works fine, but reviewers of the paper have asked that the reference levels for the model be displayed on the plot. These of course are have OR 1.0, but I can't figure out a way to force these into the glmer output or into plot_model. Is this possible?

(Here's an example of the same question using the mtcars data, in which I would want to include the reference lines for OR=1.0 for cyl=4, gear=3, and carb=1:

carmodel <- glm(am ~ as.factor(cyl) + as.factor(gear) + as.factor(carb), data = mtcars)

plot_model(carmodel)
jrcalabrese
  • 2,184
  • 3
  • 10
  • 30
dr_coops
  • 11
  • 2
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Jan 05 '23 at 20:54
  • 1
    you can *probably* just add `+ geom_hline(yintercept = 1, lty = 2)` to the `plot_model()` object, but I haven't tried it. – Ben Bolker Jan 05 '23 at 20:56
  • Ok - I updated with an example of the same problem from the mtcars dataset. – dr_coops Jan 05 '23 at 21:42
  • So you want a vertical line at 1? – Quinten Jan 05 '23 at 22:07
  • No, I want to add rows for the reference levels of the categories. These will by definition all be at 1.0 on the x-axis. – dr_coops Jan 06 '23 at 05:08

0 Answers0