lmrob.S {robustbase}R Documentation

S-regression estimators

Description

Computes an S-estimator for linear regression, using the “fast S” algorithm.

Usage

lmrob.S(x, y, control, trace.lev = 0)

Arguments

x

design matrix

y

response vector

control

list as returned by lmrob.control

trace.lev

integer indicating if the progress of the algorithm should be traced (increasingly); default trace.lev = 0 does no tracing.

Details

This function is used by lmrob.fit and not intended to be used on its own (because an S-estimator has too low efficiency ‘on its own’).

Value

A list with components

coefficients

numeric vector (length p) of S-regression coefficient estimates.

scale

the S-scale residual estimate

fitted.values

numeric vector (length n) of the fitted values.

residuals

numberic vector (legnth n) of the residuals.

weights

numeric vector (length n) of the robustness weights.

k.iter

(maximal) number of refinement iterations used.

converged

logical indicating if all refinement iterations had converged.

control

the same list as the control argument.

Author(s)

Matias Salibian-Barrera and Manuel Koller (and Martin Maechler for minor details)

See Also

lmrob, also for references.

Examples

set.seed(33)
x1 <- sort(rnorm(30)); x2 <- sort(rnorm(30)); x3 <- sort(rnorm(30))
X. <- cbind(x1, x2, x3)
y <-  10 + X. %*% (10*(2:4)) + rnorm(30)/10
y[1] <- 500   # a moderate outlier
X.[2,1] <- 20 # an X outlier
X1  <- cbind(1, X.)

(m.lm <- lm(y ~ X.))
set.seed(12)
m.lmS <- lmrob.S(x=X1, y=y,
                    control = lmrob.control(nRes = 20), trace.lev=1)
m.lmS[c("coefficients","scale")]
all.equal(m.lmS$coef, 10 * (1:4), tol = 0.005, check.attributes = FALSE)
stopifnot(all.equal(m.lmS$coef, 10 * (1:4),
                    tol = 0.005, check.attributes = FALSE),
          all.equal(m.lmS$scale, 1/10, tol = 0.09))

[Package robustbase version 0.8-0 Index]