Tell me how isoutlier function works

조회 수: 17 (최근 30일)
Lev Mihailov
Lev Mihailov 2019년 9월 2일
편집: Adam Danz 2019년 11월 22일
There is such a wonderful function isoutlier, but i can't understand
data=[27 27 17 64 27 27] % gives me the correct values
TF = isoutlier(data);
however, when the number of my values ​​increases significantly, I get errors
shows me the value 17, but does not show 64
  댓글 수: 2
Steven Lord
Steven Lord 2019년 11월 22일
Can you share a small section of code that when you run you "get errors" along with the full text of those error messages (all the text displayed in red) and any warning messages you may have received (all the text displayed in orange?)
Adam Danz
Adam Danz 2019년 11월 22일
편집: Adam Danz 2019년 11월 22일
I'm guessing that "errors" means unexpected results such as points that aren't labeled as an outlier that the OP expects to be an outlier or vice versa.

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2019년 9월 2일
편집: Adam Danz 2019년 11월 22일
The algorithm is explained in the documentation. "By default, an outlier is a value that is more than three scaled median absolute deviations (MAD) away from the median". The link provides a relatively simple equation showing how the MAD are calculated.
The reason the outlier at y=64 is not identified when the number of values increase is because your median changes and 64 is no longer 3xMAD.
There are other methods you could try. Outlier detection is not trivial and there's no sure-fire way that detects all outliers in all situations. Even the definition of what constitutes an outlier is subjective in many cases.
If all of your outliers are large, positive spikes like in your example, you could simply set a threshold that is n standard deviations from the mean and any data points beyond that value can be considered outliers.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by