scale_mad {rempsyc} | R 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)
[Package rempsyc version 0.1.8 Index]