StepSelect: Step Selection

Description Usage Arguments Value Examples

View source: R/StepSelect.R

Description

Conduct forward or backward selection for linear regression models

Usage

1
StepSelect(full, direction, k = 2, trace = FALSE)

Arguments

full

the full model for backward selection to start and the upper limit for forward selection

direction

should be either "backward" or "forward"

k

numeric, the penalty per parameter to be used in AIC; the default k = 2 is the classical AIC.

trace

to determine if the process of selection will be shown or not

Value

the final linear regression result after selection

Examples

1
2
3
4
full_lm = lm(mpg ~ ., data = mtcars)
n = dim(mtcars)[1]
StepSelect(full_lm, direction = "forward", k = log(n))
StepSelect(full_lm, direction = "backward", trace = TRUE)

yw0817/BIOS625_HW4 documentation built on Dec. 23, 2021, 9:10 p.m.