if (FALSE) { # require("mice")
# example for multiple imputed datasets
data("nhanes2", package = "mice")
imp <- mice::mice(nhanes2, printFlag = FALSE)
predictions <- lapply(1:5, function(i) {
m <- lm(bmi ~ age + hyp + chl, data = mice::complete(imp, action = i))
predict_response(m, "age")
})
pool_predictions(predictions)
}
Run the code above in your browser using DataLab