RobStatTM (version 1.0.2)

step.lmrobdet: Robust stepwise using RFPE

Description

This function performs stepwise model selection on a robustly fitted linear model using the RFPE criterion and the robust regression estimators computed with lmrobdetMM. Only backwards stepwise is currently implemented.

Usage

step.lmrobdet(object, scope, direction = c("both", "backward",
  "forward"), trace = TRUE, keep = NULL, steps = 1000,
  whole.path = FALSE)

Arguments

object

a robust fit as returned by lmrobdetMM

scope

either a formula or a list with elements lower and upper each of which is a formula. The terms in the right-hand-side of lower are always included in the model and the additional terms in the right-hand-side of upper are the candidates for inclusion/exclusion from the model. If a single formula is given, it is taken to be upper, and lower is set to the empty model. The . operator is interpreted in the context of the formula in object.

direction

the direction of stepwise search. Currenly only backward stepwise searches are implemented.

trace

logical. If TRUE information about each step is printed on the screen.

keep

a filter function whose input is a fitted model object and the associated AIC statistic, and whose output is arbitrary. Typically keep will select a subset of the components of the object and return them. The default is not to keep anything.

steps

maximum number of steps to be performed. Defaults to 1000, which should mean as many as needed.

whole.path

if FALSE (default) variables are dropped until the RFPE fails to improve. If TRUE the best variable to be dropped is removed, even if this does not improve the RFPE.

Value

If whole.path == FALSE the function returns the robust fit as obtained by lmrobdetMM using the final model. If whole.path == TRUE a list is returned containing the RFPE of each model on the sequence of submodels. The names of the components of this list are the formulas that correspods to each model.

Details

Presently only backward stepwise selection is supported. During each step the Robust Final Prediction Error (as computed by the function lmrobdetMM.RFPE) is calculated for the current model and for each sub-model achievable by deleting a single term. If the argument whole.path is FALSE, the function steps to the sub-model with the lowest Robust Final Prediction Error or, if the current model has the lowest Robust Final Prediction Error, terminates. If the argument whole.path is TRUE, the function steps through all smaller submodels removing, at each step, the variable that most reduces the Robust Final Prediction Error. The scale estimate from object is used to compute the Robust Final Prediction Error throughout the procedure.

References

http://www.wiley.com/go/maronna/robust

See Also

DCML, MMPY, SMPY

Examples

Run this code
# NOT RUN {
cont <- lmrobdet.control(bb = 0.5, efficiency = 0.85, family = "bisquare")
set.seed(300)
X <- matrix(rnorm(50*6), 50, 6)
beta <- c(1,1,1,0,0,0)
y <- as.vector(X %*% beta) + 1 + rnorm(50)
y[1:6] <- seq(30, 55, 5)
for (i in 1:6) X[i,] <- c(X[i,1:3],i/2,i/2,i/2)
Z <- cbind(y,X)
Z <- as.data.frame(Z)
obj <- lmrobdetMM(y ~ ., data=Z, control=cont)
out <- step.lmrobdetMM(obj)

# }

Run the code above in your browser using DataCamp Workspace