An outlier removal method that considers each potential outlier individually, using conditional thresholds based on top and bottom percentiles and error margins. It is a more refined alternative to simple percentile-based removal.
condextr(data, cols = NULL, group = NULL, top = 0.995,
top.error = 0.1, top.magnitude = 0.2, bottom = 0.0025, bottom.error = 0.2,
bottom.magnitude = 0.4, interval = 10, by = "min", half = 30,
times = 10, date_col = NULL, cores = NULL, verbose = FALSE)A data frame with outliers removed.
A data frame, matrix, or numeric vector. If a vector, outlier removal is applied directly.
Column indices or names of numeric variables.
Grouping column index or name. Outlier removal is performed within each group.
Parameters for the top threshold.
Parameters for the bottom threshold.
Number of outlier marking iterations between observation deletions.
Time unit for observation deletion. An invalid unit string raises an error.
Half window size in minutes for observation deletion.
Number of observation deletions.
Time column index or name.
Number of CPU cores passed to the C++ backend. NULL (default) lets the backend choose based on data size.
Logical; if TRUE, prints timing and deletion counts.
Chun-Sheng Liang <[email protected]>
The method marks values as outliers if they are the maximum or minimum and exceed a threshold that depends on a high percentile plus an error margin. After a specified number of marking steps, observation deletion is applied to remove rows with excessive missing values created by outlier removal.
1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.
condextr(obsedele(data[1:500, c(1, 4, 17:19)], cols = 3:5, group = 2),
cols = 3:5, group = 2)
Run the code above in your browser using DataLab