How do I confront the outliers from two different methods?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Mathieu NOE
2022-5-17
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!