manipulating matrix for outlier detection

2 ビュー (過去 30 日間)
sermet
sermet 2015 年 1 月 10 日
コメント済み: Greg Heath 2015 年 1 月 13 日
%ids are the point numbers, L is the measurement which need to be checked for outlier.
ids=[1;2;3;4;5;6;7;8;9;10];
L=[0.16;0.2;0.18;0.4;0.14;0.15;0.11;0.17;0.15;0.18]; %measurement
% To perform outlier detection for 0.16;
L_1=[0.2;0.18;0.4;0.14;0.15;0.11;0.17;0.15;0.18]; %without first row of L (0.16)
L_ort_1=mean(L_1);
for i=1:9 % n=9
V(i)=L_1(i)-L_ort_1;
end
V=V(:);
S=sqrt((V'*V)/7);
d=abs(L_ort_1-0.16) %0.16 is subjected to outlier detection
Sd=((S^2)/8)+S^2;
t_1=d/Sd;
t_statistics_1=tinv(0.995,7);
if t_statistics_1 > t_1
% there is no outlier for 0.16 (id=1) go on to check second number (0.20).
%L_2=[0.16;0.18;0.4;0.14;0.15;0.11;0.17;0.15;0.18] %without 0.20 (second number)
% do the same things to L2 for detection of 0.20....................
if t_statistics_1 < t_1
% there is outlier for 0.16, save its id (1) and go on to check second number (0.20)
end
end
I need to write this kind of loop for this outlier detection for each row of L.
Thanks in advance.

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 10 日
So, what's stopping you?
If you want an outlier detection method developed by the Mathworks, see this by the amazing Brett Shoelson: http://www.mathworks.com/matlabcentral/fileexchange/3961-deleteoutliers
You might also look at Median Absolute Deviation which is a more robust method than looking at the z score, which can be influenced by the outlier itself which you want to get rid of ( not a good thing obviously).
  1 件のコメント
Greg Heath
Greg Heath 2015 年 1 月 13 日
Correct. However, the sensitivity of the zscore method can be mitigated via iterated removal or modification, plots and human intervention.
Greg

サインインしてコメントする。

その他の回答 (1 件)

Greg Heath
Greg Heath 2015 年 1 月 10 日
The best way to detect outliers
1. Standardize the data to zero-mean/unit variance
2. Plot
3. Find outliers where abs(x) > mean + alpha*sigma
where alpha is a user determined parameter
Hope this helps.
Thank you for formally accepting my answer
Greg

カテゴリ

Help Center および File ExchangeCreate and Run Performance Tests についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by