FUNCTION REFERENCE

isoutlier

Find outliers in data.

Find outliers in data.

Syntax

TF = isoutlier(A)

Syntax

TF = isoutlier(A, method)

Syntax

TF = isoutlier(A, 'percentiles', [lo hi])

Syntax

TF = isoutlier(A, movmethod, window)

Syntax

TF = isoutlier(..., dim)

Syntax

TF = isoutlier(..., Name, Value)

Syntax

[TF, L, U, C] = isoutlier(...)

Works along dim (default: the first dimension whose size is not 1) of numeric vectors and matrices, or on the numeric variables of tables and timetables. Methods: 'median' (default; more than k = 3 scaled MAD from the median, scaled MAD = c*median(abs(A-median(A))) with c = -1/(sqrt(2)*erfcinv(3/2))), 'mean' (more than k = 3 standard deviations from the mean), 'quartiles' (outside [Q1-k*IQR, Q3+k*IQR], k = 1.5, quartiles as quantile computes them; center (Q1+Q3)/2), 'percentiles' (outside the given percentiles; center their midpoint), 'grubbs' (two-sided Grubbs test removing one outlier per iteration at significance alpha = 0.05) and 'gesd' (generalized extreme Studentized deviate test with at most MaxNumOutliers outliers, default the integer nearest to 10 percent of the elements, at least 1); for these two the thresholds are mean +- critical value * std of the points kept and the center is their mean. 'movmedian' and 'movmean' apply the median and mean rules with local statistics over a window: a scalar k covers sample points in [t-k/2, t+k/2) (k samples centered, one extra behind for even k), [kb kf] covers [t-kb, t+kf]; windows shrink at the ends. NaN is never an outlier and is ignored by the statistics. L, U and C are the lower threshold, upper threshold and center: one value per vector, or one per element for moving methods. Options: 'ThresholdFactor' (k; alpha for grubbs and gesd), 'SamplePoints' (sorted unique numeric, datetime or duration vector; a timetable uses its row times and needs a duration window), 'DataVariables' (names, indices or a logical mask), 'OutputFormat' ('logical' gives a logical matrix of the table size, 'tabular' a table) and 'MaxNumOutliers'.

Example

isoutlier([2 3 2 4 3 50 3 2])

Example

[TF, L, U, C] = isoutlier([1 2 3 4 100], 'quartiles')

Example

isoutlier([1 1.2 0.9 6 1.1 1 0.8], 'movmedian', 3)

Differences from MATLAB: no N-D arrays, function-handle DataVariables or multicolumn table variables. MATLAB does not publish every center and threshold rule, so C for 'quartiles', 'grubbs' and 'gesd' and the gesd default count follow the definitions above.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.