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