lmsreg
and ltsreg
are compatibility wrappers.lqs(x, …)# S3 method for formula
lqs(formula, data, …,
method = c("lts", "lqs", "lms", "S", "model.frame"),
subset, na.action, model = TRUE,
x.ret = FALSE, y.ret = FALSE, contrasts = NULL)
# S3 method for default
lqs(x, y, intercept = TRUE, method = c("lts", "lqs", "lms", "S"),
quantile, control = lqs.control(…), k0 = 1.548, seed, …)
lmsreg(…)
ltsreg(…)
y ~ x1 + x2 + …
.formula
are preferentially to be taken.NA
s are found. The default action is for the procedure to
fail. Alternatives include na.omit
and
na.exclude
, which lead to omission of
cases with missing values on any required variable. (NOTE: If
given, this argument must be named exactly.)
TRUE
the model frame,
the model matrix and the response are returned, respectively.contrasts.arg
of model.matrix.default
.x
.model.frame
returns the model frame: for the
others see the Details
section. Using lmsreg
or
ltsreg
forces "lms"
and "lts"
respectively.
Details
. This is over-ridden if
method = "lms"
.
Details
.method = "S"
, currently
corresponding to Tukey's ‘biweight’..Random.seed
. The
current value of .Random.seed
will be preserved if it is set..
lqs.default
or
lqs.control
, see control
above and Details
."lqs"
. This is a list with components
method == "S"
before IWLS refinement.method ==
"S"
) is based on the variance of those residuals whose absolute
value is less than 2.5 times the initial estimate.n
data points and p
regressors,
including any intercept. The first three methods minimize some function of the sorted squared
residuals. For methods "lqs"
and "lms"
is the
quantile
squared residual, and for "lts"
it is the sum
of the quantile
smallest squared residuals. "lqs"
and
"lms"
differ in the defaults for quantile
, which are
floor((n+p+1)/2)
and floor((n+1)/2)
respectively.
For "lts"
the default is floor(n/2) + floor((p+1)/2)
. The "S"
estimation method solves for the scale s
such that the average of a function chi of the residuals divided
by s
is equal to a given constant. The control
argument is a list with components
psamp
:p
.nsamp
:"best"
(the
default) or "exact"
or "sample"
.
If "sample"
the number chosen is min(5*p, 3000)
,
taken from Rousseeuw and Hubert (1997).
If "best"
exhaustive enumeration is done up to 5000 samples;
if "exact"
exhaustive enumeration will be attempted however
many samples are needed.adjust
:TRUE
.predict.lqs
set.seed(123) # make reproducible
lqs(stack.loss ~ ., data = stackloss)
lqs(stack.loss ~ ., data = stackloss, method = "S", nsamp = "exact")
Run the code above in your browser using DataLab