I am using the mice package (version 3.3.0) to perform multiple imputations (MI). The MI procedure works fine. For further analysis I would like to separate/split/subset imputed data by the variable ‘group’ like indicated in the example below.
library(mice)
d <- nhanes
d$group <- as.factor(c(rep("A", 13), rep("B", 12)))
str(d)
imp <- mice(d)
fit <- with(imp, lm(bmi ~ age + chl + group))
est <- pool(fit)
summary(est, digits=3)
# I would like to do is
imp.A <- imp[which(group=="A")]
imp.B <- imp[which(group=="B")]
fit.A <- with(imp.A, lm(bmi ~ age + chl))
fit.B <- with(imp.A, lm(bmi ~ age + chl))
Is it possible to split imputed data somehow?