Removes values above a top percentile and below a bottom percentile. Thresholds are computed from quantiles. Optionally, observation deletion based on consecutive missing values can be performed after outlier removal.
percoutl(data, cols = NULL, group = NULL, top = 0.995,
bottom = 0.0025, by = "min", half = 30,
date_col = NULL, cores = NULL, verbose = FALSE)A data frame with outliers removed.
A data frame or matrix. If a numeric vector is supplied, only outlier marking (no observation deletion) is performed because there is no time axis.
Column indices or names of numeric variables. If
NULL, all numeric columns are used.
Optional grouping column for group-wise outlier removal.
Top percentile threshold. Values above this quantile are removed.
Bottom percentile threshold. Values below this quantile are removed.
Time unit for observation deletion (see obsedele).
Half window size, in minutes, for consecutive missing deletion.
Time column index or name. If NULL,
automatically detected.
Number of OpenMP threads. Passed to obsedele.
Logical; if TRUE, prints timing and deletion
counts.
Chun-Sheng Liang <[email protected]>
This method is a one-size-fits-all approach and may remove non-outliers
or fail to remove some outliers. It is provided for comparison with
condextr, which uses a point-by-point weighted
conditional extremum criterion.
1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.
percoutl(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