Skip to contents

Declare an observation an outlier when \(|x - mean(x)| / sd(x) > crit\), with crit = 2 by default.

Usage

Outms(x, crit = 2)

Arguments

x

Numeric vector; at least two observations.

crit

Positive cut-off; defaults to 2.

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

This rule is provided because it is commonly used, not because it is good. Both the mean and the standard deviation have a breakdown point of 1/n, so outliers inflate the very yardstick meant to find them. It is the standard demonstration of masking: adding a second, larger outlier can stop the first from being detected. See Outmad for a rule that survives this.

References

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

Examples

x <- c(rep(2, 5), rep(3, 5), rep(4, 5), 1000)
Outms(x)$n_out          # 1000 is detected
#> [1] 1
Outms(c(x, 10000))$n_out  # masking: 1000 no longer is
#> [1] 1