Outlier (Anomaly) Detection with Matlab

Outliers (anomaly) detection in data based on several statistical hypothesis testing techniques.
90 Downloads
Updated 31 Aug 2023

View License

The present code is a Matlab function for outlier (anomaly) detection based on several powerful statistical hypothesis testing techniques:
(1) Wright (Laiyite) criterion
(2) Iglewicz-Hoaglin modified Z-score
(3) Huber-Miller MAD rule
(4) Tukey criterion
(5) Romanowski criterion
(6) Chebyshev criterion
Of course, other methods exist too, but they are not so powerful, or their usage is not straightforward (e.g., Grubbs's test, Dixon's test, Chauvenet's criterion, etc.). Compared with the built-in Matlab function isoutlier, the following correspondences exist – 'Wright' == 'mean'; 'modified Z' == 'median'; 'liberal Tukey' == 'quartiles'. Moreover, the 'grubs' and 'gesd' methods are not implemented in the present function, while 'MAD', 'Romanowski', and 'Chebyshev' methods are not implemented in the built-in function and so they are novel for the Matlab.
Several examples are given to clarify the usage of the function. For convenience, the input and output arguments are given at the beginning of the function.
The code is based on the theory described in:
[1] S. Seo. A Review and Comparison of Methods for Detecting Outliers in Univariate Data Sets (Master's Thesis). Pittsburgh, University of Pittsburgh, 2006. (Unpublished)
[2] B. Iglewicz, D. Hoaglin. ASQC Basic References in Quality Control Vol. 16: How To Detect And Handle Outliers. Milwaukee, ASQC Quality Press, 1993.
[3] C. Leys, C. Ley, O. Klein, P. Bernard, L. Licata. “Detecting outliers: Do not use standard deviation around the mean, use absolute deviation around the median”. Journal of Experimental Social Psychology, Vol. 49, No. 4, pp. 764-766, 2013.[4] B. Amidan, T. Ferryman, S. Cooley. “Data outlier detection using the Chebyshev theorem”. IEEE Aerospace Conference, pp. 3814-3819, 2005.

Cite As

Hristo Zhivomirov (2024). Outlier (Anomaly) Detection with Matlab (https://www.mathworks.com/matlabcentral/fileexchange/134546-outlier-anomaly-detection-with-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0