outliers_mad {Routliers} | R Documentation |
Detecting univariate outliers using the robust median absolute deviation
outliers_mad(x, b, threshold, na.rm)
x |
vector of values from which we want to compute outliers |
b |
constant depending on the assumed distribution underlying the data, that equals 1/Q(0.75). When the normal distribution is assumed, the constant 1.4826 is used (and it makes the MAD and SD of normal distributions comparable). |
threshold |
the number of MAD considered as a threshold to consider a value an outlier |
na.rm |
set whether Missing Values should be excluded (na.rm = TRUE) or not (na.rm = FALSE) - defaults to TRUE |
Returns Call, median, MAD, limits of acceptable range of values, number of outliers
#### Run outliers_mad x <- runif(150,-100,100) outliers_mad(x, b = 1.4826,threshold = 3,na.rm = TRUE) #### Results can be stored in an object. data(Intention) res1=outliers_mad(Intention$age) # Moreover, a list of elements can be extracted from the function, # such as all the extremely high values, # That will be sorted in ascending order #### The function should be performed on dimension rather than on isolated items data(Attacks) SOC <- rowMeans(Attacks[,c("soc1r","soc2r","soc3r","soc4","soc5","soc6", "soc7r","soc8","soc9","soc10r","soc11","soc12","soc13")]) res=outliers_mad(x = SOC)