Fits all regressions involving one regressor, two regressors, three regressors, and so on. It tests all possible subsets of the set of potential independent variables.

ols_step_all_possible(model, ...)

# S3 method for ols_step_all_possible
plot(x, model = NA, print_plot = TRUE, ...)

Arguments

model

An object of class lm.

...

Other arguments.

x

An object of class ols_best_subset.

print_plot

logical; if TRUE, prints the plot else returns a plot object.

Value

ols_step_all_possible returns an object of class "ols_step_all_possible". An object of class "ols_step_all_possible" is a data frame containing the following components:

mindex

model index

n

model number

predictors

predictors in the model

rsquare

rsquare of the model

adjr

adjusted rsquare of the model

rmse

root mean squared error of the model

predrsq

predicted rsquare of the model

cp

mallow's Cp

aic

akaike information criteria

sbic

sawa bayesian information criteria

sbc

schwarz bayes information criteria

msep

estimated MSE of prediction, assuming multivariate normality

fpe

final prediction error

apc

amemiya prediction criteria

hsp

hocking's Sp

Deprecated Function

ols_all_subset() has been deprecated. Instead use ols_step_all_possible().

References

Mendenhall William and Sinsich Terry, 2012, A Second Course in Statistics Regression Analysis (7th edition). Prentice Hall

See also

Examples

model <- lm(mpg ~ disp + hp, data = mtcars) k <- ols_step_all_possible(model) k
#> Index N Predictors R-Square Adj. R-Square Mallow's Cp #> 1 1 1 disp 0.7183433 0.7089548 0.6751205 #> 2 2 1 hp 0.6024373 0.5891853 0.5096958 #> 3 3 2 disp hp 0.7482402 0.7308774 0.6945438
# plot plot(k)
#> $plot_1
#> #> $plot_2
#> #> $plot_3
#> #> $plot_4
#> #> $plot_5
#> #> $plot_6
#>