我正在尝试运行逐步回归模型。我一直收到这条消息:
#Error in step(cdc.fit, direction = "backward") :
# number of rows in use has changed: remove missing values?
#In addition: There were 50 or more warnings (use warnings() to see the first 50)
我是否因为缺少值而收到此消息?
这是我的代码:
model=glm(health~
ALCDAY5+
AVEDRNK2+
CHILDREN+
CHKHEMO3+
POORHLTH+
BLOODCHOYes+
BPHIGH4No+
CHCOCNCRYes
, data=data, fmaily=binomial)
stepmodel_back <- model(cdc.fit,direction='backward')
summary(stepmodel_back)
谢谢!
答案 0 :(得分:0)
我没有在MASS中使用stepAIC()函数,但看起来以下行不正确:
stepmodel_back <- step(cdc.fit, direction = "backward")
您已将glm模型分配给名为&#39; model&#39;的对象,但此行不会引用此对象。应该是:
stepmodel_back <- step(model, direction = "backward)
希望这有帮助。