| outliers | R Documentation |
Flags observations whose depth falls below a threshold as outliers. The threshold can be specified as a quantile of the depth distribution (default) or as an absolute depth cutoff.
outliers(x, threshold = 0.05, absolute = FALSE, ...)
x |
A |
threshold |
Numeric scalar in (0, 1). Interpreted as a quantile of
the depth distribution when |
absolute |
Logical. If |
... |
Ignored. |
A named list:
Logical vector of length n — TRUE for outliers.
Integer vector of row indices of outlying observations.
Matrix of outlying observations.
Depth values of outlying observations.
The actual depth cutoff used.
set.seed(42)
data <- matrix(rnorm(500), nrow = 100, ncol = 5)
dd <- compute_depth(data)
# Flag bottom 5% by depth (default)
outliers(dd)
# Flag bottom 10%
outliers(dd, threshold = 0.10)
# Absolute depth cutoff
outliers(dd, threshold = 0.05, absolute = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.