Build regression model from a set of candidate predictor variables by entering predictors based on p values, in a stepwise manner until there is no variable left to enter any more.

step_forward(model, ...)

Arguments

model
an object of class lm
...
other arguments

Value

step_forward returns an object of class "step_forward". An object of class "step_forward" is a list containing the following components:

Examples

# stepwise forward regression model <- lm(y ~ ., data = surgical) step_forward(model)
#> We are selecting variables based on p value...
#> 1 variable(s) added....
#> 1 variable(s) added...
#> 1 variable(s) added...
#> 1 variable(s) added...
#> 1 variable(s) added...
#> No more variables satisfy the condition of penter: 0.3
#> Forward Selection Method #> #> Candidate Terms: #> #> 1 . bcs #> 2 . pindex #> 3 . enzyme_test #> 4 . liver_test #> 5 . age #> 6 . gender #> 7 . alc_mod #> 8 . alc_heavy #> #> ------------------------------------------------------------------------------ #> Selection Summary #> ------------------------------------------------------------------------------ #> Variable Adj. #> Step Entered R-Square R-Square C(p) AIC RMSE #> ------------------------------------------------------------------------------ #> 1 liver_test 0.455 0.444 62.5119 771.8753 296.2992 #> 2 alc_heavy 0.567 0.550 41.3681 761.4394 266.6484 #> 3 enzyme_test 0.659 0.639 24.3379 750.5089 238.9145 #> 4 pindex 0.750 0.730 7.5373 735.7146 206.5835 #> 5 bcs 0.781 0.758 3.1925 730.6204 195.4544 #> ------------------------------------------------------------------------------
# stepwise forward regression plot model <- lm(y ~ ., data = surgical) k <- step_forward(model)
#> We are selecting variables based on p value...
#> 1 variable(s) added....
#> 1 variable(s) added...
#> 1 variable(s) added...
#> 1 variable(s) added...
#> 1 variable(s) added...
#> No more variables satisfy the condition of penter: 0.3
plot(k)