Any idea how to do and represent ttest results on box plot?

43 views (last 30 days)
I have boxplot that are 6 boxplots represented in on x and y axis. I wnt to do ttest to find the signigcance of the data between the plots.
My first question is that how can I do ttest for these 6 plots? should it be based on the pair of them like 1 and 2, 1 and 3 up to 1 and 6 and then 2 and 3 and so on which would be 15 pairs. Abny idea how to do that for 6 series of numbers (6 boxplots)?
My second question is how to represent the output on the boxplot to show the significance?
Thanks a lot
Update:
I found this online and I think I need to make similar plot.
The question is now how to add those horizontal lines above the boxplots with the pvalue? and as I have 6 boxplots, I am afraid representing in that way would make the plot nasty and hard to understand. Any idea?

Answers (2)

Jakob B. Nielsen
Jakob B. Nielsen on 17 Feb 2020
Yes - the way forward is to compare 1 and 2, 1 and 3 and so on. You could look into some of the built-in tools in matlab, for example combining anova1 and multcompare, which is way easier than 'doing it by hand'. multcompare includes a graphical representation as well.

Matt J
Matt J on 17 Feb 2020
Usually, I just overlay them in powerpoint. But if you must automate this, one not too difficult way would be to use the line command to draw the lines, keeping their handles in a vector H. Then, put the p-values in the legend,
legend(H,"p = " + pvalues);

Community Treasure Hunt

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

Start Hunting!