R中基于BIC提取最优模型

Extract the optimal model based on BIC in R

我在 R 中使用以下函数来选择具有最小 BIC 的模型

step(fit4, direction = "both", k=log(nrow(college_train)))

在我的R markdown profile中,每次迭代和结果都出现了,超过4页。

我知道最后一个就是我要的型号

当我使用 step()function

时,R 中是否有函数仅显示我的 R markdown 配置文件中的最后一个模型

我不确定 R 降价,但你可以试试

step(fit4, direction = "both", trace = 0, k=log(nrow(college_train)))