簡體   English   中英

多重插補的池化結果,pool()函數錯誤,mice包

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

我是多重插補的新手。 我遵循了我在網上找到的教程,並對我自己的數據進行了多次插補。 一切都很順利,直到最后一步,我需要將來自不同數據集的結果與估算值合並。 R 給了我以下錯誤消息:

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") 

我沒有找到任何有效的解決方案。 有人可以幫忙嗎? 謝謝。

這個 GitHub 問題與您的問題有關。 您可以使用pool.scalar()函數來解決它。

嘗試直接在mice給出的輸出上運行模型,而不是在complete函數給出的輸出上運行

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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM