scale_mad: Standardize based on the absolute median deviation

View source: R/scale_mad.R

scale_madR Documentation

Standardize based on the absolute median deviation

Description

Scale and center ("standardize") data based on the median absolute deviation (MAD).

Usage

scale_mad(x)

Arguments

x

The vector to be scaled.

Details

The function subtracts the median to each observation, and then divides the outcome by the MAD. This is analogous to regular standardization which subtracts the mean to each observaion, and then divides the outcome by the standard deviation.

For the easystats equivalent, use: datawizard::standardize(x, robust = TRUE).

Value

A numeric vector of standardized data.

References

Leys, C., Ley, C., Klein, O., Bernard, P., & Licata, L. (2013). Detecting outliers: Do not use standard deviation around the mean, use absolute deviation around the median. Journal of Experimental Social Psychology, 49(4), 764–766. https://doi.org/10.1016/j.jesp.2013.03.013

Examples

scale_mad(mtcars$mpg)

RemPsyc/rempsyc documentation built on July 2, 2024, 9:41 p.m.