Learn R Programming

robustbase (version 0.92-5)

lmrob: MM-type Estimators for Linear Regression

Description

Computes fast MM-type estimators for linear (regression) models.

Usage

lmrob(formula, data, subset, weights, na.action, method = "MM",
      model = TRUE, x = !control$compute.rd, y = FALSE,
      singular.ok = TRUE, contrasts = NULL, offset = NULL,
      control = NULL, init = NULL, ...)

Arguments

formula
a symbolic description of the model to be fit. See lm and formula for more details.
data
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables
subset
an optional vector specifying a subset of observations to be used in the fitting process.
weights
an optional vector of weights to be used in the fitting process (in addition to the robustness weights computed in the fitting process).
na.action
a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is
method
string specifying the estimator-chain. MM is interpreted as SM. See Details, notably the currently recommended setting = "KS2014".
model, x, y
logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response) are returned.
singular.ok
logical. If FALSE (the default in S but not in R) a singular fit is an error.
contrasts
an optional list. See the contrasts.arg of model.matrix.default.
offset
this can be used to specify an a priori known component to be included in the linear predictor during fitting. An offset term can be included in the formula instead or as well, and if b
control
a list specifying control parameters; use the function lmrob.control(.) and see its help page.
init
an optional argument to specify or supply the initial estimate. See Details.
...
additional arguments can be used to specify control parameters directly instead of (but not in addition to!) via control.

Value

  • An object of class lmrob; a list including the following components:
  • coefficientsThe estimate of the coefficient vector
  • scaleThe scale as used in the M estimator.
  • residualsResiduals associated with the estimator.
  • convergedTRUE if the IRWLS iterations have converged.
  • iternumber of IRWLS iterations
  • rweightsthe robustness weights $\psi(r_i/S) / (r_i/S)$.
  • fitted.valuesFitted values associated with the estimator.
  • init.SThe list returned by lmrob.S or lmrob.M.S (for MM-estimates only)
  • initA similar list that contains the results of intermediate estimates (not for MM-estimates).
  • rankthe numeric rank of the fitted linear model.
  • covThe estimated covariance matrix of the regression coefficients
  • df.residualthe residual degrees of freedom.
  • weightsthe specified weights (missing if none were used).
  • na.action(where relevant) information returned by model.frame on the special handling of NAs.
  • offsetthe offset used (missing if none were used).
  • contrasts(only where relevant) the contrasts used.
  • xlevels(only where relevant) a record of the levels of the factors used in fitting.
  • callthe matched call.
  • termsthe terms object used.
  • modelif requested (the default), the model frame used.
  • xif requested, the model matrix used.
  • yif requested, the response used.
  • In addition, non-null fits will have components assign, and qr relating to the linear fit, for use by extractor functions such as summary.

encoding

utf8

Details

[object Object],[object Object],[object Object]

References

Croux, C., Dhaene, G. and Hoorelbeke, D. (2003) Robust standard errors for robust estimators, Discussion Papers Series 03.16, K.U. Leuven, CES.

Koller, M. (2012), Nonsingular subsampling for S-estimators with categorical predictors, ArXiv e-prints, arXiv:1208.5595v1.

Koller, M. and Stahel, W.A. (2011), Sharpening Wald-type inference in robust regression for small samples, Computational Statistics & Data Analysis 55(8), 2504--2515.

Maronna, R. A., and Yohai, V. J. (2000). Robust regression with both continuous and categorical predictors. Journal of Statistical Planning and Inference 89, 197--214.

Rousseeuw, P.J. and Yohai, V.J. (1984) Robust regression by means of S-estimators, In Robust and Nonlinear Time Series, J. Franke, W. Härdle and R. D. Martin (eds.). Lectures Notes in Statistics 26, 256--272, Springer Verlag, New York.

Salibian-Barrera, M. and Yohai, V.J. (2006) A fast algorithm for S-regression estimates, Journal of Computational and Graphical Statistics, 15(2), 414--427.

Yohai, V.J. (1987) High breakdown-point and high efficiency estimates for regression. The Annals of Statistics 15, 642--65.

See Also

lmrob.control; for the algorithms lmrob.S, lmrob.M.S and lmrob.fit; and for methods, summary.lmrob, for the extra statistics, notably $R^2$ (R squared); predict.lmrob, print.lmrob, plot.lmrob, and weights.lmrob.

Examples

Run this code
data(coleman)
set.seed(0)
## Default for a very long time:
summary( m1 <- lmrob(Y ~ ., data=coleman) )
## Nowadays strongly recommended for routine use:
summary( m2 <- lmrob(Y ~ ., data=coleman, setting = "KS2011") )
plot(residuals(m2) ~ weights(m2, type="robustness")) ##-> weights.lmrob()
abline(h=0, lty=3)

data(starsCYG, package = "robustbase")
## Plot simple data and fitted lines
plot(starsCYG)
  lmST <-    lm(log.light ~ log.Te, data = starsCYG)
(RlmST <- lmrob(log.light ~ log.Te, data = starsCYG))
abline(lmST, col = "red")
abline(RlmST, col = "blue")
summary(RlmST)
vcov(RlmST)
stopifnot(all.equal(fitted(RlmST),
                    predict(RlmST, newdata = starsCYG),
                    tolerance = 1e-14))

## --- init argument
## string
set.seed(0)
m3 <- lmrob(Y ~ ., data=coleman, init = "S")
stopifnot(all.equal(m1[-18], m3[-18]))
## function
initFun <- function(x, y, control, mf) {
    init.S <- lmrob.S(x, y, control)
    list(coefficients=init.S$coef, scale = init.S$scale)
}
set.seed(0)
m4 <- lmrob(Y ~ ., data=coleman, method = "M", init = initFun)
## list
m5 <- lmrob(Y ~ ., data=coleman, method = "M",
            init = list(coefficients = m3$init$coef, scale = m3$scale))
stopifnot(all.equal(m4[-17], m5[-17]))

Run the code above in your browser using DataLab