Running a stepwise linear model with BIC criterion

r lm
user2846211 picture user2846211 · Oct 16, 2013 · Viewed 24.7k times · Source

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")

Answer

rcs picture rcs · Oct 16, 2013

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.