HuberM.Rd
(Generalized) Huber M-estimator of location with MAD scale, being
sensible also when the scale is zero where huber()
returns an error.
numeric vector.
positive factor; the algorithm winsorizes at k
standard deviations.
initial location estimator.
scale estimator held constant through the iterations.
logical, indicating whether NA
values should be stripped before the computation proceeds. Defaults to FALSE.
confidence level of the interval. If set to NA
(which is the default) no confidence interval will be calculated.
The type of confidence interval required. The value should be any subset
of the values "wald"
, "boot"
.
the dots are passed to the function boot.ci
, when confidence intervalls are calculated.
The standard error is computed using the \(\tau\) correction factor but no finite sample correction.
The original function is not exported, but can be accessed as DescTools::.huberM
.
If conf.level
is set to NA
then the result will be
single numeric value
and
if a conf.level
is provided, a named numeric vector with 3 elements:
the estimate for location
lower bound of the confidence interval
upper bound of the confidence interval
Huber, P. J. (1981) Robust Statistics. Wiley.
HuberM(c(1:9, 1000))
#> [1] 5.553915
mad (c(1:9, 1000))
#> [1] 3.7065
set.seed(7)
x <- c(round(rnorm(1000), 1), round(rnorm(50, m=10, sd = 10)))
HuberM(x, conf.level=0.95)
#> hm lwr.ci upr.ci
#> 0.05600116 -0.01020176 0.12220408
if (FALSE) { # \dontrun{
# scale zero
HuberM(rep(9, 100))
mad (rep(9, 100))
# bootstrap confidence intervals
HuberM(x, conf.level=0.95, ci.type="boot")
} # }