Learn R Programming

rrcov (version 0.3-07)

ltsReg: Robust regression with high breakdown point

Description

Carries out least trimmed squares (LTS) regression.

Usage

ltsReg(x, ...)

## S3 method for class 'formula':
ltsReg(formula, data, \dots, 
        model = TRUE, x.ret = FALSE, y.ret = FALSE)

## S3 method for class 'default':
ltsReg(x, y, intercept=TRUE, alpha=NULL, nsamp=500, 
        adjust=FALSE, mcd=TRUE, qr.out=FALSE, yname=NULL, seed=0, 
        use.correction=TRUE, control, \dots)

Arguments

formula
a formula of the form 'y ~ x1 + x2 + ...'.
data
data frame from which variables specified in 'formula' are to be taken.
model, x.ret, y.ret
logical. If 'TRUE' the model frame, the model matrix and the response are returned, respectively.
x
a matrix or data frame containing the explanatory variables.
y
the response: a vector of length the number of rows of 'x'.
intercept
if true, a model with constant term will be estimated; otherwise no constant term will be included. Default is intercept = TRUE
alpha
the percentage of squared residuals whose sum will be minimized. Its default value is 0.5. In general, alpha must be a value between 0.5 and 1.
nsamp
number of subsets used for initial estimates or "best" or "exact". Default is nsamp = 500. If nsamp="best" exhaustive enumeration is done, as far as the number of trials do not exceed 5000. I
adjust
whether to perform intercept adjustment at each step. This could be quite time consuming, therefore the default is adjust = FALSE
mcd
whether to compute robust distances using Fast-MCD.
qr.out
whether to return the QR decomposition. Default is qr.out = FALSE
yname
the name of the dependent variable. Default is yname = NULL
seed
starting value for random generator. Default is seed = 0
use.correction
whether to use finite sample correction factors. Default is use.correction=TRUE
control
a list with estimation options - same as these provided in the fucntion specification. If the control object is supplied, the parameters from it will be used. If parameters are passed also in the invocation statement, they will override the co
...
arguments passed to or from other methods.

Value

  • The function ltsReg returns an object of class "lts". The function summary is used to obtain and print a summary table of the results. The generic accessor functions coefficients, fitted.values and residuals extract various useful features of the value returned by ltsReg. An object of class lts is a list containing at least the following components:
  • critthe value of the objective function of the LTS regression method, i.e. the sum of the h smallest squared raw residuals.
  • coefficientsvector of coefficient estimates (including the intercept,when intercept=TRUE), obtained after reweighting
  • bestthe best subset found and used for computing the raw estimates. The size of best is equal to quan.
  • fitted.valuesvector like y containing the fitted values of the response after reweighting.
  • residualsvector like y containing the residuals from the weighted least squares regression.
  • scalescale estimate of the reweighted residuals.
  • alphasame as the input parameter alpha.
  • quanthe number h of observations that have determined the least trimmed squares estimator
  • interceptsame as the input parameter intercept.
  • cnp2a vector of length two containing the consistency correction factor and the finite sample correction factor of the final estimate of the error scale.
  • raw.coefficientsvector of raw coefficient estimates (including the intercept,when intercept=TRUE).
  • raw.scalescale estimate of the raw residuals.
  • raw.residvector like y containing the raw residuals from the regression.
  • raw.cnp2a vector of length two containing the consistency correction factor and the finite sample correction factor of the raw estimate of the error scale.
  • lts.wtvector like y containing weights that can be used in a weighted least squares. These weights are 1 for points with reasonably small raw residuals, and 0 for points with large raw residuals.
  • methodcharacter string naming the method (Least Trimmed Squares).
  • Xthe input data as a matrix.
  • Ythe response variable as a vector.

Details

The LTS regression method minimizes the sum of the h smallest squared residuals, where h must be at least half the number of observations. The default value of h is roughly 0.5n where n is the total number of observations, but the user may choose any value between n/2 and n. The LTS estimate of the error scale is given by the minimum of the objective function multiplied by a consistency factor and a finite sample correction factor - see Pison et.al. (2002) for details. The rescaling factors for the raw and final estimates are returned also in the vectors raw.cnp2 and cnp2 of length 2 respectively. The finite sample corrections can be suppressed by setting use.correction=FALSE. The computations are performed using the Fast LTS algorithm proposed by Rousseeuw and Van Driessen (1999). The formula interface has an implied intercept term. This can be removed by using either y ~ x - 1 or y ~ 0 + x. See formula for more details.

References

p. j. Rousseeuw (1984), Least Median of Squares Regression. Journal of the American Statistical Association, 79, pp. 871-881. P. J. Rousseeuw and A. M. Leroy (1987) Robust Regression and Outlier Detection. Wiley. P. J. Rousseeuw and K. van Driessen (1999) Computing LTS Regression for Large Data Sets, Technical Report, University of Antwerp, submitted P. J. Rousseeuw and K. van Driessen (1999) A fast algorithm for the minimum covariance determinant estimator. Technometrics, 41, 212--223. Pison, G., Van Aelst, S., and Willems, G. (2002), Small Sample Corrections for LTS and MCD, Metrika, 55, 111-123.

See Also

covMcd summary.lts for summaries. The generic functions coef, residuals, fitted.

Examples

Run this code
data(heart)
ltsReg(heart.x, heart.y)

data(stackloss)
ltsReg(stack.loss ~ ., data = stackloss)

Run the code above in your browser using DataLab