
Last chance! 50% off unlimited learning
Sale ends in
Computes the robust
scaleTau2(x, c1 = 4.5, c2 = 3.0, na.rm = FALSE, consistency = TRUE,
mu0 = median(x),
sigma0 = median(x.), mu.too = FALSE, iter = 1, tol.iter = 1e-7)
numeric vector of length one (if mu.too
is FALSE
as by
default) or two (when mu.too = TRUE
) with robust scale or
(location,scale) estimators
numeric vector
non-negative numbers, specifying cutoff values for the biweighting of the mean and the rho function respectively.
a logical value indicating whether NA
values should be stripped before the computation proceeds.
logical indicating if the consistency correction factor (for the scale) should be applied.
the initial location estimate median
.
the initial scale estimate
logical indicating if both location and scale should be
returned or just the scale (when mu.too=FALSE
as by default).
positive integer or logical indicating if and how many
iterations should be done. The default, iter = 1
computes the
“traditional” tau-estimate of scale.
if iter
is true, or iter > 1
, stop the
iterations when tol.iter
, and
Original by Kjell Konis with substantial modifications by Martin Maechler.
First, mad(x,
constant=1)
is computed. Robustness weights
When iter=TRUE
or iter > 1
, the above estimate is
iterated in a fixpoint iteration, setting iter
or the fixpoint is found in the sense that
\
scaleTau2(*, consistency=FALSE)
returns consistency =
TRUE
as by default.
Note that for n = length(x) == 2
, all equivariant scale estimates are
proportional, and specifically, scaleTau2(x, consistency=FALSE)
== mad(x, constant=1)
. See also the reference.
Maronna, R.A. and Zamar, R.H. (2002) Robust estimates of location and dispersion of high-dimensional datasets; Technometrics 44(4), 307--317.
Yohai, V.J., and Zamar, R.H. (1988). High breakdown-point estimates of regression by means of the minimization of an efficient scale. Journal of the American Statistical Association 83, 406--413.
Sn
, Qn
, mad
;
further covOGK
for which scaleTau2
was designed.
x <- c(1:7, 1000)
sd(x) # non-robust std.deviation
scaleTau2(x)
scaleTau2(x, mu.too = TRUE)
(sI <- scaleTau2(c(x,Inf), mu.too = TRUE))
(sIN <- scaleTau2(c(x,Inf,NA), mu.too = TRUE, na.rm=TRUE))
stopifnot({
identical(sI, sIN)
all.equal(scaleTau2(c(x, 999), mu.too = TRUE), sIN,
tol = 1e-15)
})
if(doExtras <- robustbase:::doExtras()) {
set.seed(11)
## show how much faster this is, compared to Qn
x <- sample(c(rnorm(1e6), rt(5e5, df=3)))
(system.time(Qx <- Qn(x))) ## 2.04 [2017-09, lynne]
(system.time(S2x <- scaleTau2(x))) ## 0.25 (ditto)
cbind(Qn = Qx, sTau2 = S2x)
}## Qn sTau2
## 1.072556 1.071258
Run the code above in your browser using DataLab