0
提取拒绝变量的名称我使用GLM对象从阶梯函数
stepglm<-step(glmmodel)
上阶梯函数和步骤拒绝来自glmmodel 2个变量。有没有办法从stepglm对象中提取被拒绝变量的名字?看起来stepglm只是一个glm对象,所以也许有没有简单的方法来做到这一点?
提取拒绝变量的名称我使用GLM对象从阶梯函数
stepglm<-step(glmmodel)
上阶梯函数和步骤拒绝来自glmmodel 2个变量。有没有办法从stepglm对象中提取被拒绝变量的名字?看起来stepglm只是一个glm对象,所以也许有没有简单的方法来做到这一点?
在MASS包中尝试stepAIC
。这里是一个例子:
library(MASS)
example(birthwt) # construct bwt
birthwt.glm <- glm(low ~ ., family = binomial, data = bwt)
birthwt.step <- stepAIC(birthwt.glm, trace = FALSE)
as.character(birthwt.step$anova$Step)[-1]
## [1] "- ftv" "- age"