Learn R Programming

topolow (version 2.0.1)

detect_outliers_mad: Detect Outliers Using Median Absolute Deviation

Description

Detects outliers in numeric data using the Median Absolute Deviation (MAD) method. This robust method is less sensitive to extreme values than standard deviation and works well for non-normally distributed data.

Usage

detect_outliers_mad(data, k = 3)

Value

A list containing:

outlier_mask

Logical vector indicating outliers

stats

List containing:

  • median: Median of data

  • mad: Median absolute deviation

  • n_outliers: Number of outliers detected

#' @importFrom stats median mad

Arguments

data

Numeric vector of values to analyze

k

Numeric threshold for outlier detection (default: 3).

Details

The function calculates the median and MAD of the data and identifies points that are more than k MADs from the median as outliers.