scale_mad | R Documentation |
Scale and center ("standardize") data based on the median absolute deviation (MAD).
scale_mad(x)
x |
The vector to be scaled. |
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)
.
A numeric vector of standardized data.
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
scale_mad(mtcars$mpg)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.