Skip to contents

Declare an observation an outlier when |x - M| / MADN > crit, where M is the sample median, MADN = MAD / 0.6745 and MAD is the unscaled median absolute deviation. Both M and MADN have a breakdown point of 0.5, which is what lets this rule survive the masking that defeats Outms.

Usage

Outmad(x, crit = 2.24)

Arguments

x

Numeric vector; at least two observations. More than half the values tied at the median gives MAD = 0 and no usable scale.

crit

Positive cut-off; defaults to 2.24. Use 3.5 for Hampel's original identifier.

Value

A list with components flag (0/1 per observation), which (1-based positions), out_val, n_out, center, scale, dis, crit, n, estimate (= n_out) and method.

Details

The divisor is Wilcox's 0.6745, not R's stats::mad constant of 1.4826, so MADN here equals stats::mad(x, constant = 1 / 0.6745); the two agree to about seven significant digits.

The constant 2.24 is from Rousseeuw and van Zomeren (1990). Equation (2.14) is the Hampel identifier, for which Hampel used 3.5 rather than 2.24; crit is exposed for that reason.

References

Wilcox, R. R. (2017). Modern Statistics for the Social and Behavioral Sciences: A Practical Introduction, 2nd edn. CRC Press, section 2.5.2, equation (2.14), p.33.

Rousseeuw, P. J. and van Zomeren, B. C. (1990). Unmasking multivariate outliers and leverage points. Journal of the American Statistical Association 85(411), 633-639.

Examples

x <- c(2, 2, 3, 3, 3, 4, 4, 4, 100000, 100000)
Outmad(x)$n_out   # 2 -- both extremes found
#> [1] 2
Outms(x)$n_out    # 0 -- the mean/SD rule is masked
#> [1] 0