简体   繁体   中英

Pooling results of multiple imputation, pool() function error, mice package

I am new to multiple imputation. I followed tutorials that I found online and performed multiple imputations on my own data. Everything went well until the very last step when I need to pool results from different data sets with imputed values. R gave me the following error messages:

pool(rep1_mi)
Error: No tidy method for objects of class qr
In addition: Warning messages:
1: In get.dfcom(object, dfcom) : Infinite sample size assumed.
2: 'tidy.numeric' is deprecated.
See help("Deprecated") 
3: 'tidy.numeric' is deprecated.
See help("Deprecated") 
4: 'tidy.numeric' is deprecated.
See help("Deprecated") 
5: 'tidy.numeric' is deprecated.
See help("Deprecated") 
6: 'tidy.numeric' is deprecated.
See help("Deprecated") 
7: 'tidy.numeric' is deprecated.
See help("Deprecated") 

I didn't find any solution that works. Could anyone please help? Thanks.

This GitHub issue is related to your problem. You can work around it by using the pool.scalar() function.

Try to run your model directly on the output given by mice and not on the output given by complete function

library(psych)
# to create some missingness 
bfi[4,1] = NA_character_
bfi[6,2] = NA_character_
bfi[9,1] = NA_character_
bfi[7,2] = NA_character_
bfi[6,1] = NA_character_

# run mice
imput.bfi <- mice(bfi, m = 3)

# when "complete" function is used, "pool" function will not run
bfi.imp.dat=mice::complete(imput.bfi, action="long", inc = TRUE)
# run linear regression 
lm.bfi=with(bfi.imp.dat, lm(N1 ~ age))
# pool will not work here 
pool(lm.bfi)


# In this case the "pool" function will work properly
# run linear regression 
lm.bfi=with(imput.bfi, lm(N1 ~ age))
# pool results 
pool(lm.bfi)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM