Detect outliers using MAD (Median Absolute Deviation)
Usage
is_outlier(
x,
nmads = 2.5,
constant = 1.4826,
type = c("both", "lower", "higher")
)Arguments
- x
Numeric vector.
- nmads
Number of median absolute deviations (MADs) from the median to define the boundaries for outliers. Default is
2.5.- constant
Constant factor to convert the MAD to a standard deviation. Default is
1.4826, which is consistent with the MAD of a normal distribution.- type
Type of outliers to detect. Available options are
"both","lower", or"higher". Iftypeis"both", it detects both lower and higher outliers. Iftypeis"lower", it detects only lower outliers. Iftypeis"higher", it detects only higher outliers.