Build regression model from a set of candidate predictor variables by entering and removing predictors based on p values, in a stepwise manner until there is no variable left to enter or remove any more.
ols_stepwise(model, ...) # S3 method for default ols_stepwise(model, pent = 0.1, prem = 0.3, details = FALSE, ...) # S3 method for ols_stepwise plot(x, model = NA, ...)
model | An object of class |
---|---|
... | Other arguments. |
pent | p value; variables with p value less than |
prem | p value; variables with p more than |
details | Logical; if |
x | An object of class |
ols_stepwise
returns an object of class "ols_stepwise"
.
An object of class "ols_stepwise"
is a list containing the
following components:
candidate predictor variables according to the order by which they were added or removed from the model
addition/deletion
total number of steps
variables retained in the model (after addition)
coefficient of determination
akaike information criteria
bayesian information criteria
sawa's bayesian information criteria
adjusted r-square
root mean square error
mallow's Cp
predictors
Chatterjee, Samprit and Hadi, Ali. Regression Analysis by Example. 5th ed. N.p.: John Wiley & Sons, 2012. Print.
# NOT RUN { # stepwise regression model <- lm(y ~ ., data = surgical) ols_stepwise(model) # }# NOT RUN { # stepwise regression plot model <- lm(y ~ ., data = surgical) k <- ols_stepwise(model) plot(k) # }