I am trying to perform stepwise regression with direction as "both" based on BIC in r.
But everytime is performing based on AIC only
Following is my code
train <- read.csv("Regression_train.csv", header=TRUE,
stringsAsFactors=FALSE)
test <- read.csv("Regression_test.csv", header=TRUE,
stringsAsFactors=FALSE)
fit.all <- lm(joyjoy ~ ., train)
null <- lm(joyjoy ~ 1, train )
step(null, scope=list(lower=null, upper=fit.all),
criterion = "BIC", direction="both", k = log(n))
I don't know why it is performing stepwise bidirectional based on AIC only even though after specifying BIC
Can someone please help here?