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

step_backward(model, ...)

Arguments

model
an object of class lm
...
other inputs

Value

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

Examples

# stepwise backward regression model <- lm(y ~ ., data = surgical) step_backward(model)
#> We are eliminating variables based on p value...
#> No more variables satisfy the condition of prem: 0.3
#> Backward Elimination Method #> #> Candidate Terms: #> #> 1 . bcs #> 2 . pindex #> 3 . enzyme_test #> 4 . liver_test #> 5 . age #> 6 . gender #> 7 . alc_mod #> 8 . alc_heavy #> #> -------------------------------------------------------------------------- #> Elimination Summary #> -------------------------------------------------------------------------- #> Variable Adj. #> Step Removed R-Square R-Square C(p) AIC RMSE #> -------------------------------------------------------------------------- #> 1 alc_mod 0.782 0.749 7.0141 734.4068 199.2637 #> 2 gender 0.781 0.754 5.0870 732.4942 197.2921 #> 3 age 0.781 0.758 3.1925 730.6204 195.4544 #> --------------------------------------------------------------------------
# stepwise backward regression plot model <- lm(y ~ ., data = surgical) k <- step_backward(model)
#> We are eliminating variables based on p value...
#> No more variables satisfy the condition of prem: 0.3
plot(k)