# stepwise forward regression
model <- lm(y ~ ., data = surgical)
ols_step_forward_aic(model)
# stepwise forward regression plot
model <- lm(y ~ ., data = surgical)
k <- ols_step_forward_aic(model)
plot(k)
# final model
k$model
Run the code above in your browser using DataLab