huberM {sfsmisc} | R Documentation |
(Generalized) Huber M-estimator of location with MAD scale, being
sensible also when the scale is zero where huber()
returns an error.
huberM(x, k = 1.5, tol = 1e-06, mu = median(x), s = mad(x, center=mu), warn0scale = getOption("verbose"))
x |
numeric vector. |
k |
positive factor; the algorithm winsorizes at k
standard deviations. |
tol |
convergence tolerance. |
mu |
initial location estimator. |
s |
scale estimator held constant through the iterations. |
warn0scale |
logical; if true, and s is 0 and
length(x) > 1 , this will be warned about. |
list of location and scale parameters, and number of iterations used.
mu |
location estimate |
s |
the s argument,MAD scale estimate – unless s is |
it |
the number of “Huber iterations” used. |
Martin Maechler building on the MASS code mentioned.
Huber, P. J. (1981) Robust Statistics. Wiley.
hubers
(and huber
) in package MASS;
mad
.
huberM(c(1:9, 1000)) mad (c(1:9, 1000)) mad (rep(9, 100)) huberM(rep(9, 100))