I'm new to package mice
in R. But I'm trying to impute 5 datasets from popmis
and then fit an lmer()
model with()
each and finally pool()
across them.
I think the pool()
function in mice()
doesn't work with the lmer()
call from lme4
package, right?
If that is the case, is there a way to write a custom-made function that acts like pool()
for my case below?
library(mice)
library(lme4)
imp <- mice(popmis, m = 5) # `popmis` is a dataset from `mice`
fit <- with(imp, lme4::lmer(popular ~ sex + (1|school))) # works fine.
pool(fit) # BUT this one fails, should I loop here?