cleanOutliers function

Clean Returns Outliers

Clean Returns Outliers

Outliers are "cleaned" by shrinking or rejecting data whose distance from the median (med) is larger in absolute value than a specified value k multiplied by the median absolute deviation from the median (mad). Outlier shrinkage results in the data value being set equal to the nearest of med-kmad and med+kmad. Rejected data is assigned an NA. Shrinkage is the default.

cleanOutliers(x, k = 3, shrink = TRUE)

Arguments

  • x: A numeric vector
  • k: A numeric value, which multiplies the mad. Smaller values of k result in greater fractions of data which is either shrunk of rejected, and larger values of k result in smaller fractions of the data that are shrunk or rejected.
  • shrink: A logical variable whose default is TRUE.

Returns

an outlier cleaned numeric object

Examples

args(cleanOutliers)
  • Maintainer: Doug Martin
  • License: GPL-2
  • Last published: 2023-08-30

Useful links