isoutlier
Detects outliers in data.
Category: Data Import and Analysis > Preprocessing Data
Syntax
TF = isoutlier(A)
true for elements more than three scaled median absolute deviations from the median.
TF = isoutlier(A, method)
Uses another rule, such as 'quartiles' or 'mean'.
[TF, L, U, C] = isoutlier(___)
Also returns the lower and upper thresholds and the center value.
Description
With the default method the scaled median absolute deviation is 1.4826 * median(abs(A - median(A))). A point farther than three of these from the median is flagged. Because median and MAD barely move when a few extreme values are present, the rule is robust, unlike the mean and standard deviation.
The result tells you which elements to inspect; use filloutliers to replace them or rmoutliers to drop them.
Input arguments
A- Numeric vector or matrix (columns are analyzed).
method'median'(default),'mean','quartiles','grubbs'or'gesd'.
Output arguments
TF- Logical array,
trueat outliers. L, U- Lower and upper thresholds.
C- Center value (the median for the default method).
Example
Spot the odd value
x = [1 2 3 4 5 6 7 8 9 10 50];
[tf, lo, hi, c] = isoutlier(x)
x(tf)
Output
tf = 1×11 logical array
0 0 0 0 0 0 0 0 0 0 1
lo = -7.3434
hi = 19.3434
c = 6
ans = 50