在 R 中使用插入符号逐步回归 [英] stepwise regression using caret in R

查看:45
本文介绍了在 R 中使用插入符号逐步回归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 R 中使用了 Leaps 包来执行向前和向后的特征消除.但是,我希望自动执行交叉验证和预测操作.因此,如何在插入符号中使用向前/向后选择?

I have used leaps package in R to perform forward and backward feature elimination. However, I want automate the cross validation and prediction operations. Therefore, how can I use forward/backward selection in caret?

在leaps包中你可以这样做

in leaps package you could do it this way

forward <- regsubsets(x ~ ., data, nvmax = 20, 
                         method = "forward")  

推荐答案

您应该能够在 caret::train() 中使用 method=glmStepAIC 运行逐步回归> 来自 MASS 包.有关详细信息,请参阅 caret 文档网站上的 caret 支持的模型列表.

You should be able to run a stepwise regression in caret::train() with method=glmStepAIC from the MASS package. For details, see the list of models supported by caret on the caret documentation website.

可以在 上访问此模型的插入符号测试用例插入符号 GitHub 存储库.

这篇关于在 R 中使用插入符号逐步回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆