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.
ols_best_subset(model, ...) # S3 method for ols_best_subset plot(x, model = NA, ...)
model | An object of class |
---|---|
... | Other inputs. |
x | An object of class |
ols_best_subset
returns an object of class "ols_best_subset"
.
An object of class "ols_best_subset"
is a data frame containing the
following components:
model number
predictors in the model
rsquare of the model
adjusted rsquare of the model
predicted rsquare of the model
mallow's Cp
akaike information criteria
sawa bayesian information criteria
schwarz bayes information criteria
estimated MSE of prediction, assuming multivariate normality
final prediction error
amemiya prediction criteria
hocking's Sp
Kutner, MH, Nachtscheim CJ, Neter J and Li W., 2004, Applied Linear Statistical Models (5th edition). Chicago, IL., McGraw Hill/Irwin.
Other variable selection procedures: ols_step_all_possible
,
ols_step_backward
,
ols_step_forward
,
ols_stepaic_backward
,
ols_stepaic_both
,
ols_stepaic_forward
# NOT RUN { model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars) ols_best_subset(model) # }# NOT RUN { # plot model <- lm(mpg ~ disp + hp + wt + qsec, data = mtcars) k <- ols_best_subset(model) plot(k) # }