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