How do I confront the outliers from two different methods?

2 views (last 30 days)
Hi! I have used two different methods to remove outliers from a certain data set. Here they are below:
%Grubb's test
figure;
plot(Fetal_table.mean_value_of_short_term_variability) %Fetal_table is my table with all the features in it and mean_value_of_short_term_variability is the gaussian feature in which I want to delete the outliers
histogram(Fetal_table.mean_value_of_short_term_variability)
figure;
vec_out = isoutlier(Fetal_table.mean_value_of_short_term_variability,"grubbs");
figure;
plot(Fetal_table.mean_value_of_short_term_variability, "og"); hold on;
Fetal_table(vec_out,:)=[];
%Box plot rule
figure;
plot(Fetal_table.mean_value_of_short_term_variability) %Fetal_table is my table with all the features in it and mean_value_of_short_term_variability is the gaussian feature in which I want to delete the outliers
histogram(Fetal_table.mean_value_of_short_term_variability)
figure;
vec_out = isoutlier(Fetal_table.mean_value_of_short_term_variability,"quartile");
figure;
plot(Fetal_table.mean_value_of_short_term_variability, "og"); hold on;
Fetal_table(vec_out,:)=[];
How can I compare if the same outliers have been removed and if different ones have been removed, understand which ones and understand which method is the most effective?
  1 Comment
Mathieu NOE
Mathieu NOE on 17 May 2022
hello
what do you mean by "compare" ? want just to plot the selected outliers ? visual check or more advanced computations ? below I simply overlay the data and the outliers - we could also make one single plot with both sets of outliers
also the variable name is quite long and make the code less readable as you repeat it quite often , why not make it simpler like :
data = Fetal_table.mean_value_of_short_term_variability;
%Grubb's test
figure;
plot(data) %Fetal_table is my table with all the features in it and mean_value_of_short_term_variability is the gaussian feature in which I want to delete the outliers
histogram(data)
figure;
vec_out = isoutlier(data,"grubbs");
data_out = Fetal_table(vec_out,:);
figure;
plot(data, "og"); hold on; plot(data_out, "or");
% data_out=[]; % optional
%Box plot rule
figure;
plot(data) %Fetal_table is my table with all the features in it and mean_value_of_short_term_variability is the gaussian feature in which I want to delete the outliers
histogram(data)
figure;
vec_out = isoutlier(data,"quartile");
data_out = Fetal_table(vec_out,:);
figure;
plot(data, "og"); hold on; plot(data_out, "ok");
% data_out=[]; % optional

Sign in to comment.

Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!