Running a stepwise linear model with BIC criterion

∥☆過路亽.° 提交于 2019-12-20 18:31:06

问题


Is it possible to set a stepwise linear model to use the BIC criteria rather than AIC?

I've been trying this but it still calculates each step using AIC values rather than BIC

null = lm(data[,1] ~ 1)
full = lm(data[,1] ~ age + bmi + gender + group)
step(null, scope = list(lower=null,upper=full),
     direction="both", criterion = "BIC")

回答1:


Add the argument k=log(n) to the step function (n number of samples in the model matrix)

From ?step:

Arguments:
...

k the multiple of the number of degrees of freedom used for the penalty. Only k = 2 gives the genuine AIC; k = log(n) is sometimes referred to as BIC or SBC.



来源:https://stackoverflow.com/questions/19400494/running-a-stepwise-linear-model-with-bic-criterion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!