I am currently following this guide: https://mran.microsoft.com/snapshot/2020-03-10/web/packages/sjPlot/vignettes/plot_model_estimates.html
I copied and pasted the following for the guide:
library(sjPlot)
library(sjlabelled)
library(sjmisc)
library(ggplot2)
data(efc)
theme_set(theme_sjplot())
# create binary response
y <- ifelse(efc$neg_c_7 < median(na.omit(efc$neg_c_7)), 0, 1)
# create data frame for fitting model
df <- data.frame(
y = to_factor(y),
sex = to_factor(efc$c161sex),
dep = to_factor(efc$e42dep),
barthel = efc$barthtot,
education = to_factor(efc$c172code)
)
# set variable label for response
set_label(df$y) <- "High Negative Impact"
# fit model
m1 <- glm(y ~., data = df, family = binomial(link = "logit"))
I added two models:
# added
m2 <- glm(y ~ sex + dep, data = df, family = binomial(link = "logit"))
m3 <- glm(y ~ sex + dep + barthel, data = df, family = binomial(link = "logit"))
I wanted the plot to only show certain coefficients:
plot_models(m1, m2, m3,
terms = c("sex", "dep"))
I got this error:
Error in (show.zeroinf && minfo$is_zero_inflated) || minfo$is_dispersion :
invalid 'y' type in 'x || y'
In addition: Warning message:
Could not access model information.
I wanted to facet the different plots:
plot_models(m1, m2, m3,
facet_grid = TRUE)
And I got this error:
Error in (show.zeroinf && minfo$is_zero_inflated) || minfo$is_dispersion :
invalid 'y' type in 'x || y'
In addition: Warning message:
Could not access model information.
Could anyone provide me some insight into what could be going on here? Thanks!