Closed mattjamesmartin closed 2 months ago
Try specifying the type
and newdata
arguments explicitly:
plot_predictions(
mtcars_imp_logit,
condition = "hp",
type = "response",
newdata = mtcars_with_missing)
That works! Thank you so much for your fast reply.
Bug reports must include:
I am running a logit model using data imputed from the mice package. I am trying to then use
plot_predictions()
to visualize my pooled results, but it is not working seemingly due to a bug. It won't accept the mida object produced by my model. Below is an example usingmtcars
:Create random missing values
mtcars_with_missing <- mtcars missing_prop <- 0.1 # Proportion of missing values n_missing <- round(nrow(mtcars) * missing_prop)
rows_to_replace <- sample(1:nrow(mtcars), size = n_missing, replace = FALSE)
Replace values with NA
mtcars_with_missing[rows_to_replace, ] <- NA
Impute data
mtcars_imp <- mice(mtcars_with_missing, m = 5, method = "pmm", seed = 123)
Create mida object
mtcars_imp_logit <- with(data = mtcars_imp, exp = glm(am ~ cyl + hp + wt, family = "binomial"))
plot_predictions(mtcars_imp_logit, condition = "hp")