对来自小鼠(R)的估算数据子集运行glm.mids [英] Run glm.mids on a subset of imputed data from mice (R)
问题描述
当我尝试在mids
插补对象的子集上运行glm.mids
时出现错误:
I get an error when I try to run glm.mids
on a subset of a mids
imputation object:
library(mice)
imp2 = mice(nhanes)
glm.mids( (hyp==2)~bmi+chl, data=imp2, subset=(age==1) )
给出了错误的错误消息
"Error in eval(expr, envir, enclos) :
..1 used in an incorrect context, no ... to look in"
即使该语法与原始数据集上的常规glm
兼容:
even though the syntax works with regular glm
on the original dataset:
glm( (hyp==2)~bmi+chl, data=nhanes, subset=(age==1) )
文档?glm.mids
并没有专门介绍subset
,但是说您可以将其他参数传递给glm
.如果我不能将subset
与glm.mids
一起使用,是否有直接将mids
列表对象子集的好方法?
The documentation ?glm.mids
doesn't specifically address subset
but says that you can pass additional parameters onto glm
. If I can't use subset
with glm.mids
, is there a good way to subset the mids
list object directly?
推荐答案
我已经自由地重写了glm.mids
.这有点糊涂.问题似乎源于将属性传递给glm的隐式本质.
I have taken the liberty of rewriting glm.mids
. It is a bit kludgy. The issue seems to stem from the implicit nature by which attributes are passed into glm.
另请参阅以下帖子:
https://stat.ethz.ch/pipermail/r-help/2003-November/041537.html