ols_step_best_subset: Best subsets regression

Description Usage Arguments Value Deprecated Function References See Also Examples

View source: R/ols-best-subsets-regression.R

Description

Select the subset of predictors that do the best at meeting some well-defined objective criterion, such as having the largest R2 value or the smallest MSE, Mallow's Cp or AIC.

Usage

1
2
3
4
5
ols_step_best_subset(model, ...)

## S3 method for class 'ols_step_best_subset'
plot(x, model = NA, print_plot = TRUE,
  ...)

Arguments

model

An object of class lm.

...

Other inputs.

x

An object of class ols_step_best_subset.

print_plot

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

Value

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

n

model number

predictors

predictors in the model

rsquare

rsquare of the model

adjr

adjusted rsquare 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

gmsep

estimated MSE of prediction, assuming multivariate normality

jp

final prediction error

pc

amemiya prediction criteria

sp

hocking's Sp

Deprecated Function

ols_best_subset() has been deprecated. Instead use ols_step_best_subset().

References

Kutner, MH, Nachtscheim CJ, Neter J and Li W., 2004, Applied Linear Statistical Models (5th edition). Chicago, IL., McGraw Hill/Irwin.

See Also

Other variable selection procedures: ols_step_all_possible, ols_step_backward_aic, ols_step_backward_p, ols_step_both_aic, ols_step_forward_aic, ols_step_forward_p

Examples

1
2
3
4
5
6
7
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
ols_step_best_subset(model)

# plot
model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars)
k <- ols_step_best_subset(model)
plot(k)

olsrr documentation built on Feb. 10, 2020, 5:07 p.m.