Learn R Programming

robustbase (version 0.92-5)

lmrob.S: S-regression estimators

Description

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

Usage

lmrob.S(x, y, control, trace.lev = control$trace.lev, mf = NULL)

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.
mf
(optional) a model frame as returned by model.frame, used only to compute outlier statistics, see outlierStats.

Value

  • A list with components
  • coefficientsnumeric vector (length $p$) of S-regression coefficient estimates.
  • scalethe S-scale residual estimate
  • fitted.valuesnumeric vector (length $n$) of the fitted values.
  • residualsnumeric vector (length $n$) of the residuals.
  • rweightsnumeric vector (length $n$) of the robustness weights.
  • k.iter(maximal) number of refinement iterations used.
  • convergedlogical indicating if all refinement iterations had converged.
  • controlthe same list as the control argument.

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).

By default, the subsampling algorithm uses a customized LU decomposition which ensures a non singular subsample (if this is at all possible). This makes the Fast-S algorithm also feasible for categorical and mixed continuous-categorical data.

One can revert to the old subsampling scheme by setting the parameter subsampling in control to "simple".

See Also

lmrob, also for references.

Examples

Run this code
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(unname(m.lmS$coef), 10 * (1:4), tolerance = 0.005)
stopifnot(all.equal(unname(m.lmS$coef), 10 * (1:4), tolerance = 0.005),
          all.equal(m.lmS$scale, 1/10, tolerance = 0.09))

Run the code above in your browser using DataLab