【发布时间】:2015-04-21 15:22:12
【问题描述】:
R 的mice 包含一个函数pool.compare,用于比较适合估算对象的嵌套模型。如果我尝试包含交互术语:
library(mice)
imput = mice(nhanes2)
mi1 <- with(data=imput, expr=lm(bmi~age*hyp))
mi0 <- with(data=imput, expr=lm(bmi~age+hyp))
pc <- pool.compare(mi1, mi0, method="Wald")
然后它返回以下错误:
Error in pool(fit1) :
Different number of parameters: coef(fit): 6, vcov(fit): 5
听起来方差-协方差矩阵不包含交互项作为其自己的变量。解决这个问题的最佳方法是什么?
【问题讨论】: