robrange {regr0} | R Documentation |
Determines a robust range of the data on the basis of the trimmed mean and mean absolute deviation
robrange(data, trim = 0.2, fac = 3, na.rm=TRUE)
data |
a vector of data. Missing values are dropped |
trim |
trimming proportion |
fac |
factor used for expanding the range, see Details |
na.rm |
logical: should NAs be removed? If FALSE, result will be NA if there are NAs in 'data'. |
The function determines the trimmed mean m
and then the "upper
trimmed mean" s
of absolute deviations from m, multiplied by
fac
. The robust minimum is then defined as m-fac*s
or
min(data)
, whichever is larger, and similarly for the maximum.
The robust range.
Werner Stahel, ETH Zurich
x <- c(rnorm(20),rnorm(3,5,20)) robrange(x)