winsorize_mad {rempsyc} | R Documentation |
Winsorize based on the absolute median deviation
Description
Winsorize (bring extreme observations to usually +/- 3 standard deviations) data based on median absolute deviations instead of standard deviations.
Usage
winsorize_mad(x, criteria = 3)
Arguments
x |
The vector to be winsorized based on the MAD. |
criteria |
How many MAD to use as threshold (similar to standard deviations) |
Details
For the easystats equivalent, use:
datawizard::winsorize(x, method = "zscore", threshold = 3, robust = TRUE)
.
Value
A numeric vector of winsorized 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
winsorize_mad(mtcars$qsec, criteria = 2)
[Package rempsyc version 0.1.8 Index]