ltsReg(x, ...)
"ltsReg"(formula, data, subset, weights, na.action, model = TRUE, x.ret = FALSE, y.ret = FALSE, contrasts = NULL, offset, ...)
"ltsReg"(x, y, intercept = TRUE, alpha = , nsamp = , adjust = , mcd = TRUE, qr.out = FALSE, yname = NULL, seed = , trace = , use.correction = , wgtFUN = , control = rrcov.control(), ...)
formula
of the form y ~ x1 + x2 + ...
.formula
are to be taken.NA
s. The default is set by
the na.action
setting of options
, and is
na.fail
if that is unset. The factory-fresh
default is na.omit
. Another possible value is
NULL
, no action. Value na.exclude
can be useful.logical
s indicating if the
model frame, the model matrix and the response are to be returned,
respectively.contrasts.arg
of model.matrix.default
.offset
term can be included in the
formula instead or as well, and if both are specified their sum is used.x
.intercept = TRUE
alpha
must between
0.5 and 1."best"
or "exact"
. Default is nsamp = 500
. For
nsamp="best"
exhaustive enumeration is done, as long as the
number of trials does not exceed 5000. For "exact"
,
exhaustive enumeration will be attempted however many samples are needed.
In this case a warning message will be displayed saying that the
computation can take a very long time. adjust = FALSE
.qr
); defaults to false.yname = NULL
.Random.seed
, see rrcov.control
.FALSE
; values $>= 2$
also produce print from the internal (Fortran) code.use.correction=TRUE
function
, specifying
how the weights for the reweighting step should be computed.
Up to April 2013, the only option has been the original proposal in
(1999), now specified by wgtFUN = "01.original"
(or via control
).ltsReg
returns an object of class "lts"
.
The summary
method function is used to obtain (and
print) a summary table of the results, and plot()
can be used to plot them, see the the specific help pages.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:
intercept=TRUE
), obtained after reweighting.
length(best) == quan = h.alpha.n(alpha,n,p)
.
y
containing the fitted values
of the response after reweighting.y
containing the residuals from
the weighted least squares regression.alpha
.intercept
.intercept=TRUE
).y
containing the raw residuals
from the regression.alpha=1/2
) is roughly $n / 2$, more precisely,
(n+p+1) %/% 2
where $n$ is the
total number of observations, but by setting alpha
, the user
may choose higher values up to n, where
$h = h(\alpha,n,p) =$ h.alpha.n(alpha,n,p)
. 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). As always, the formula interface has an implied intercept term which can be
removed either by y ~ x - 1
or y ~ 0 + x
. See
formula
for more details.
P. J. Rousseeuw and A. M. Leroy (1987) Robust Regression and Outlier Detection. Wiley.
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.
lmrob.S()
provides a fast S estimator with similar
breakdown point as ltsReg()
but better efficiency.
For data analysis, rather use lmrob
which is based on
lmrob.S
. covMcd
;
summary.lts
for summaries.
data(heart)
## Default method works with 'x'-matrix and y-var:
heart.x <- data.matrix(heart[, 1:2]) # the X-variables
heart.y <- heart[,"clength"]
ltsReg(heart.x, heart.y)
data(stackloss)
ltsReg(stack.loss ~ ., data = stackloss)
Run the code above in your browser using DataLab