我对R语言中的mice
包不太熟悉。但是我正在尝试从popmis
中填补5个数据集,然后用with()
每个数据集分别拟合一个lmer()
模型,最后通过pool()
函数汇总。
我认为mice()
包中的pool()
函数无法与lme4
包中的lmer()
函数一起使用,对吗?
如果是这样的话,是否有一种方法可以编写自定义函数,以便像下面的情况一样运作类似于pool()
的函数?
library(mice)
library(lme4)
imp <- mice(popmis, m = 5) # `popmis` is a dataset from `mice`
fit <- with(imp, lme4::lmer(popular ~ sex + (1|school))) # works fine.
pool(fit) # BUT this one fails, should I loop here?
ubar
应该仅显示为(intercept)
而不是sex
(因为该模型仅具有截距的随机效应),这里发生了什么? - rnorouzian