I have an glmer
model in R which I want to plot predictions for. I found the plot_model function from the sjPlot library and it works fine.
Here is a MWE:
library(lattice)
cbpp$response <- sample(c(0,1), replace=TRUE, size=nrow(cbpp))
gm1 <- glmer(response ~ size + incidence + (1 | herd),
data = cbpp, family = binomial)
For example, calling plot_model(gm1, type = "pred", show.data = TRUE)
yields the following figure:
However, I am not familiar with R and I am having a hard time trying to control the plot aesthetics and plotting multiple models into the same figure (already asked a question regarding that issue here). I am familiar with Python and matplotlib and getting these figures to work on a Python environment would be much simpler for me.
I'm guessing one way to accomplish this would be taking the y values (predicted probabilities of fire) from R and exporting them so I could read them in Python in order to plot them against each covariate (evi prev) in this example. However, I am not sure how to do this. Furthermore, I tried to read sjPlot
source code to figure out how it plots the predictions but could not figure it out either.