Box plots for Kruskal-Wallis

9 vues (au cours des 30 derniers jours)
Sylwia Kaduk
Sylwia Kaduk le 7 Fév 2020
Commenté : Sylwia Kaduk le 10 Fév 2020
Hello,
I'm plotting Kruskal-Wallis results for my paper. I'm not sure how to interpret folded edges on the plot (shown with an arrow on the picture) and how to add mean lines to the plots. Thanks for help
kruskal wallis.PNG

Réponse acceptée

fred  ssemwogerere
fred ssemwogerere le 9 Fév 2020
Hello, when the end point of a notch is lower than the 25th quartile of your data, that folding effect will occur. This effect is common to small datasets or small group size (when between groups of data).
% To calculate the end points of the lower and upper notch
lowerNotch=median(data)-1.57*iqr(data)/sqrt(numel(data)); % iqr is interquartile range
upperNotch=median(data)+1.57*iqr(data)/sqrt(numel(data));
% For a small value of "n" the notch will tend to extend beyond either the 75th percentile or 25th percentile (the upper and lower ends of the box respectively.
% If you compute the 25th percentile of your data and compare it to the end point of the lower notch, you will
% find this to be true. However, that won't be the case with the upper notch based on your plot.
  4 commentaires
fred  ssemwogerere
fred ssemwogerere le 10 Fév 2020
Hello, you do not need to call the boxplot function. You can add the mean values on the same boxplot generated by the statistical test. With the boxplot from your statistical test, just get the handle for the current axes.
handl=get(gca);
hold on;
% Compute the mean value for each data group.
% Am assuming your different data groups are arranged in different columns of one matrix called: "gpdata".
avg=mean(gpdata); % a row vector output showing means for different data groups
% get the "XTick" of the current axes, and plot the mean values to correspond to their respective XTickLabel
scatter(handl.XTick,avg,[],'filled');
hold off
% This should be able to show the mean values as circular filled blue (default) markers on the same box plot generated from the statistical test
Sylwia Kaduk
Sylwia Kaduk le 10 Fév 2020
Wow, it worked. Thanks a lot, it's a big help

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by