manipulating matrix for outlier detection
Afficher commentaires plus anciens
%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.
Réponse acceptée
Plus de réponses (1)
Greg Heath
le 10 Jan 2015
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
Catégories
En savoir plus sur Particle & Nuclear Physics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!