forward | R Documentation |
Adaptation of existing methods based on AIC/BIC.
forward(model, alpha = 0.2, full = FALSE, force.in)
backward(model, alpha = 0.2, full = FALSE, hierarchy = TRUE, force.in)
stepWise(model, alpha.enter = 0.15, alpha.remove = 0.15, full = FALSE)
stepWiseBack(model, alpha.remove = 0.15, alpha.enter = 0.15, full = FALSE)
wideForward(formula, data, alpha = 0.2, force.in = NULL)
model |
object class |
formula |
|
data |
|
alpha |
|
full |
|
force.in |
|
alpha.enter |
|
alpha.remove |
|
hierarchy |
|
F-based versions of built in stepwise methods.
The final linear model after selection is returned.
Kristian Hovde Liland
set.seed(0)
data <- data.frame(y = rnorm(8),
x = factor(c('a','a','a','a','b','b','b','b')),
z = factor(c('a','a','b','b','a','a','b','b')))
mod <- lm(y ~ x + z, data=data)
forward(mod)
backward(mod)
stepWise(mod)
stepWiseBack(mod)
# Forward selection for wide matrices (large number of predictors)
set.seed(0)
mydata <- data.frame(y = rnorm(6), X = matrix(rnorm(60),6,10))
fs <- wideForward(y ~ ., mydata)
print(fs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.