rlars(x, ...)
## S3 method for class 'formula':
rlars(formula, data, ...)
## S3 method for class 'default':
rlars(x, y, sMax = NA,
centerFun = median, scaleFun = mad, winsorize = FALSE,
pca = FALSE, const = 2, prob = 0.95, fit = TRUE,
s = c(0, sMax), regFun = lmrob, regArgs = list(),
crit = c("BIC", "PE"), splits = foldControl(),
cost = rtmspe, costArgs = list(),
selectBest = c("hastie", "min"), seFactor = 1,
ncores = 1, cl = NULL, seed = NULL, model = TRUE,
tol = .Machine$double.eps^0.5, ...)
as.data.frame
) containing the variables in
the model. If not found in data, the variables are taken
froNA
(the default),
predictors are sequenced as long as there are twice as
many observations as predictors.median
).mad
).FALSE
).FALSE
). The distances of the observations are
then computed on the PCA scoresTRUE
, the default) or to
simply return the sequence (FALSE
).lmrob
).regFun
."BIC"
for the Bayes
information criterion and "PE"
for
resampling-based prediction error estimation.perry
).cost
.perrySelect
). The default is to use
a one-standard-error rule.NA
, all available processor cores are used. For
fitting models along the sequmakeCluster
.
This is preferred over ncores
for tasks that are
parallelized on the Rlevel, in which case.Random.seed
). This is
useful because many robust regression functions
(including lmro
robStandardize
.fit
is FALSE
, an integer vector
containing the indices of the sequenced predictors.
Else if crit
is "PE"
, an object of class
"perryRlars"
(inheriting from classes
"perrySeqModel"
and "perryTuning"
, see
perryTuning
). It contains
information on the prediction error criterion, and
includes the final model as component finalModel
.
Otherwise an object of class "rlars"
(inheriting
from class "seqModel"
) with the following
components:TRUE
for "rlars"
models)."bicSelect"
containing the BIC values and indicating the final model
(only returned if argument crit
is "BIC"
and argument s
indicates more than one step along
the sequence).model
is TRUE
).model
is TRUE
).winsorize
is TRUE
).coef
,
fitted
,
plot
,
predict
,
residuals
,
lmrob
## generate data
# example is not high-dimensional to keep computation time low
library("mvtnorm")
set.seed(1234) # for reproducibility
n <- 100 # number of observations
p <- 25 # number of variables
beta <- rep.int(c(1, 0), c(5, p-5)) # coefficients
sigma <- 0.5 # controls signal-to-noise ratio
epsilon <- 0.1 # contamination level
Sigma <- 0.5^t(sapply(1:p, function(i, j) abs(i-j), 1:p))
x <- rmvnorm(n, sigma=Sigma) # predictor matrix
e <- rnorm(n) # error terms
i <- 1:ceiling(epsilon*n) # observations to be contaminated
e[i] <- e[i] + 5 # vertical outliers
y <- c(x %*% beta + sigma * e) # response
x[i,] <- x[i,] + 5 # bad leverage points
## fit robust LARS model
rlars(x, y, sMax = 10)
Run the code above in your browser using DataLab