如何在多次插补后提取拟合值

时间:2017-07-27 14:01:22

标签: lm predict imputation

busan<-subset(influ_busan, select = c(CNT,temp_min,temp_diff,humid_mean,hpa_mean,rad_mean,wind_mean,o3))

new_busan<-mice(busan, seed=12345, n=5)

lm_busan <- with(new_busan,lm(CNT~temp_min+temp_diff+humid_mean+hpa_mean+rad_mean+wind_mean+o3))

summary(lm_busan)
busan_predict<-data.frame(fitted.values(lm_busan))

这是我的简单版本语法。我对NA使用多次插补,在多次插补后,我想提取拟合值。但是,我无法提取拟合值,如何提取拟合值?

1 个答案:

答案 0 :(得分:0)

您可以通过extract_imputations版本的mice功能执行此操作;希望很快将被纳入主mice版本:

请参阅:https://github.com/stefvanbuuren/mice/pull/51

devtools::install_github("alexwhitworth/mice")
library(mice)
new_busan <- mice(busan, seed= 12345, m=2)
busan_predict <- extract_imputations(busan, new_busan$imp, j= 1)
busan_predict <- extract_imputations(busan, new_busan$imp, j= 2)

编辑显然,我没有彻底阅读鼠标文档。此功能已存在于鼠标中 - mice::complete