if (FALSE) {
# stepwise regression
model <- lm(y ~ ., data = stepdata)
ols_step_both_aic(model)
# stepwise regression plot
model <- lm(y ~ ., data = stepdata)
k <- ols_step_both_aic(model)
plot(k)
# final model
k$model
}
Run the code above in your browser using DataLab