DescTools (version 0.99.15)

RobRange: Robust Range

Description

Determines a robust range of the data on the basis of the trimmed mean and variance.

Usage

RobRange(x, trim = 0.2, fac = 3, na.rm = FALSE)

Arguments

x
a vector of data.
trim
the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint. Default is 0.2.
fac
factor used for expanding the range, see Details. Default is 3.
na.rm
a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

  • The robust range.

Details

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(x), whichever is larger, and similarly for the maximum.

See Also

RobScale

Examples

Run this code
x <- c(rnorm(20), rnorm(3, 5, 20))
RobRange(x)

# compared to:
range(x)

Run the code above in your browser using DataLab