% Remove the value(s) most differing from the mean % % Description: % % This function can remove the outliers or replace by sample mean or median. % % Usage: % % [res] = rmoutlier(x,fill,median,opposite) % % Arguments: % % x: a dataset, most frequently a vector. If argument is a % matrix, each column is treated as independent dataset. % % fill: If set to 1 (default 0), the median or mean is placed instead of % outlier. Otherwise, the outlier(s) is/are simply removed. % % median: If set to 1 (default 0), median is used instead of mean in outlier % replacement. % % opposite: if set to 1 (default 0), replaces opposite value (if largest value has % maximum difference from the mean, it replaces smallest and vice % versa) % % Value: % % A dataset of the same type as argument, with outlier(s) removed or % replaced by appropriate means or medians. % % Author(s): % % Lukasz Komsta, ported from R package 'outliers'. % See R News, 6(2):10-13, May 2006 % %