Build regression model from a set of candidate predictor variables by entering and removing predictors based on Akaike Information Criteria, in a stepwise manner until there is no variable left to enter or remove any more.

stepaic_both(model, details = FALSE)

Arguments

model
an object of class lm
details
logical; if TRUE details of variable selection will be printed on screen

Value

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

Examples

# stepwise regression model <- lm(y ~ ., data = surgical) stepaic_both(model)
#> No more variables to be added or removed.
#> #> #> Stepwise Summary #> -------------------------------------------------------------------------------------- #> Variable Method AIC RSS Sum Sq R-Sq Adj. R-Sq #> -------------------------------------------------------------------------------------- #> liver_test addition 771.875 4565248.06 3804272.477 0.455 0.444 #> alc_heavy addition 761.439 3626170.761 4743349.776 0.567 0.55 #> enzyme_test addition 750.509 2854006.401 5515514.136 0.659 0.639 #> pindex addition 735.715 2091160.477 6278360.06 0.75 0.73 #> bcs addition 730.62 1833716.447 6535804.09 0.781 0.758 #> -------------------------------------------------------------------------------------- #>
# stepwise regression plot model <- lm(y ~ ., data = surgical) k <- stepaic_both(model)
#> No more variables to be added or removed.
plot(k)