Learn R Programming

sfsmisc (version 0.9-4)

huberM: Safe (generalized) Huber M-Estimator of Location

Description

(Generalized) Huber M-estimator of location with MAD scale, being sensible also when the scale is zero where huber() returns an error.

Usage

huberM(x, k = 1.5, tol = 1e-06, mu = median(x), s = mad(x, center=mu),
       warn0scale = getOption("verbose"))

Arguments

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.

Value

  • list of location and scale parameters, and number of iterations used.
  • mulocation estimate
  • sthe s argument,MAD scale estimate -- unless s is
  • itthe number of Huber iterations used.

References

Huber, P. J. (1981) Robust Statistics. Wiley.

See Also

hubers (and huber) in package MASS; mad.

Examples

Run this code
huberM(c(1:9, 1000))
mad  (c(1:9, 1000))
mad  (rep(9, 100))
huberM(rep(9, 100))

Run the code above in your browser using DataLab