stepwise

0th

Percentile

Stepwise Model Selection

This function is a front end to the stepAIC function in the MASS package.

Keywords
models
Usage
stepwise(mod, 
    direction = c("backward/forward", "forward/backward", "backward", "forward"), 
    criterion = c("BIC", "AIC"), ...)
Arguments
mod
a model object of a class that can be handled by stepAIC.
direction
if "backward/forward" (the default), selection starts with the full model and eliminates predictors one at a time, at each step considering whether the criterion will be improved by adding back in a variable removed at a previous st
criterion
for selection. Either "BIC" (the default) or "AIC". Note that stepAIC labels the criterion in the output as "AIC" regardless of which criterion is employed.
...
arguments to be passed to stepAIC.
Value

  • The model selected by stepAIC.

References

W. N. Venables and B. D. Ripley Modern Applied Statistics Statistics with S, Fourth Edition Springer, 2002.

See Also

stepAIC

Aliases
  • stepwise
Examples
# adapted from ?stepAIC in MASS
require(MASS)
example(birthwt)
birthwt.glm <- glm(low ~ ., family = binomial, data = bwt)
stepwise(birthwt.glm, trace = FALSE)
stepwise(birthwt.glm, direction="forward/backward")
Documentation reproduced from package Rcmdr, version 1.9-4, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.