模型选择仅放回拦截模型

发布于 2025-02-09 03:56:17 字数 758 浏览 2 评论 0原文

我正在用冠心病与几个变量对模型进行逻辑回归(请参阅数据框架)。

ind sbp tobacco  ldl adiposity typea obesity alcohol age chd
1   1 160   12.00 5.73     23.11    49   25.30   97.20  52   1
2   2 144    0.01 4.41     28.61    55   28.87    2.06  63   1
...

我在此模型上进行了逐步选择以接收最佳模型,但是结果我只包含截距。为什么会呢?这是什么意思?

model <-glm(chd ~ ., data = CHD, family  = "binomial"(link = logit))
intercept_only <- glm(chd ~ 1, data=CHD,  family  = "binomial"(link = logit))

#perform backward stepwise regression
back <- step(intercept_only, direction='backward', scope=formula(model), trace=0)

#view results of backward stepwise regression

  Step Df Deviance Resid. Df Resid. Dev      AIC
1      NA       NA       461   596.1084 598.1084```

I am performing logistic regression on the model with CHD sickness vs a few variables (see the data frame).

ind sbp tobacco  ldl adiposity typea obesity alcohol age chd
1   1 160   12.00 5.73     23.11    49   25.30   97.20  52   1
2   2 144    0.01 4.41     28.61    55   28.87    2.06  63   1
...

I performed backward stepwise selection on this model to receive the best model, but I get as the result the model that contains only the intercept. Why can it be? What does it mean?

model <-glm(chd ~ ., data = CHD, family  = "binomial"(link = logit))
intercept_only <- glm(chd ~ 1, data=CHD,  family  = "binomial"(link = logit))

#perform backward stepwise regression
back <- step(intercept_only, direction='backward', scope=formula(model), trace=0)

#view results of backward stepwise regression

  Step Df Deviance Resid. Df Resid. Dev      AIC
1      NA       NA       461   596.1084 598.1084```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放低过去 2025-02-16 03:56:17

要进行后退回归,您应该从包含变量的模型开始,而不是仅具有截距的模型:

back&lt; - step(model,direction ='backward',scope = formula(model),trace = 0 )

intercept_only仅在设置direction ='forthrow' o或direction ='两个''时才能使用模型。

To do backward regression, you should start with a model that contains variables, rather than the model with intercept only:

back <- step(model, direction='backward', scope=formula(model), trace=0)

The intercept_only model should only be used if you set direction='forward' or direction='both'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文