How can I add a layer showing the distribution on a conditional variable in a probability plot?

I am fitting the following regression:

model <- glm(DV ~ conditions + predictor + conditions*predictor, family = binomial(link = "probit"), data = d)

I use 'sjPlot' (and 'ggplot2') to make the following plot:

library("ggplot2")
library("sjPlot")
plot_model(model, type = "pred", terms = c("predictor", "conditions")) +
  xlab("Xlab") +
  ylab("Ylab") +
  theme_minimal() +
  ggtitle("Title")>

But I can't figure out how to add a layer showing the distribution on the conditioning variable like I can easily do by setting "hist = TRUE" using 'interplot':

library("interplot")
interplot(model, var1 = "conditions", var2 = "predictor", hist = TRUE) +
  xlab("Xlab") +
  ylab("Ylab") +
  theme_minimal() +
  ggtitle("Title") 

I have tried a bunch of layers using just ggplot as well. I am open for any suggestions!

ggplot(d, aes(x=predictor, y=DV, color=conditions))+
  geom_smooth(method = "glm") +
  xlab("Xlab") +
  ylab("Ylab") +
  theme_minimal() +
  ggtitle("Title")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.