R/ols-stepaic-backward-regression.R
ols_step_backward_aic.Rd
Build regression model from a set of candidate predictor variables by removing predictors based on akaike information criterion, in a stepwise manner until there is no variable left to remove any more.
ols_step_backward_aic(model, ...) # S3 method for default ols_step_backward_aic(model, progress = FALSE, details = FALSE, ...) # S3 method for ols_step_backward_aic plot(x, print_plot = TRUE, ...)
model | An object of class |
---|---|
... | Other arguments. |
progress | Logical; if |
details | Logical; if |
x | An object of class |
print_plot | logical; if |
ols_step_backward_aic
returns an object of class "ols_step_backward_aic"
.
An object of class "ols_step_backward_aic"
is a list containing the
following components:
model with the least AIC; an object of class lm
total number of steps
variables removed from the model
akaike information criteria
error sum of squares
regression sum of squares
rsquare
adjusted rsquare
ols_stepaic_backward()
has been deprecated. Instead use ols_step_backward_aic()
.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
Other variable selection procedures: ols_step_all_possible
,
ols_step_backward_p
,
ols_step_best_subset
,
ols_step_both_aic
,
ols_step_forward_aic
,
ols_step_forward_p
#> #> #> Backward Elimination Summary #> --------------------------------------------------------------------------- #> Variable AIC RSS Sum Sq R-Sq Adj. R-Sq #> --------------------------------------------------------------------------- #> Full Model 736.390 1825905.713 6543614.824 0.78184 0.74305 #> alc_mod 734.407 1826477.828 6543042.709 0.78177 0.74856 #> gender 732.494 1829435.617 6540084.920 0.78142 0.75351 #> age 730.620 1833716.447 6535804.090 0.78091 0.75808 #> --------------------------------------------------------------------------- #># stepwise backward regression plot model <- lm(y ~ ., data = surgical) k <- ols_step_backward_aic(model) plot(k)#> Warning: `prepend()` is deprecated as of rlang 0.4.0. #> #> Vector tools are now out of scope for rlang to make it a more #> focused package. #> This warning is displayed once per session.# final model k$model#> #> Call: #> lm(formula = paste(response, "~", paste(preds, collapse = " + ")), #> data = l) #> #> Coefficients: #> (Intercept) bcs pindex enzyme_test liver_test alc_heavy #> -1178.330 59.864 8.924 9.748 58.064 317.848 #>