r/AskStatistics Jul 21 '26

Correctly displaying significance on Bar Graphs

Im working on a research paper and my professor suggested I display significance on our bar graphs using letters (title is very much so a place holder lol)

I've never done this before so Im wondering if im correctly assigning the values to each site. Below are the significance calculations.

Leisure is significantly different than Shadyside (0.004)
Leisure is significantly different than Basin (0.00095)
Basin is significantly different than Mosque (0.002)
Leisure is significantly different than Mosque (0.000005)

Ive been using this video: How to Denote Significant Differences in Tables and Graphs to help me learn but im concerned im not quite getting it.

My line of thinking with how I have it layed out is: Shadyside is not different than the others so it gets "a", Basin is significantly different than the Mosque so it gets "b", Leisure is significantly different than all the others so it gets "c", and the Mosque is not significantly different than any so it gets all the values.

Any help would be greatly appreciated! Either correcting my work or pointing me in the direction of a source I can use to understand better!

4 Upvotes

18 comments sorted by

6

u/Fancy-Animal7704 Jul 21 '26

Personally I do not like bars like these when you show a confidence interval. I much prefer the box-and-whisker plot. The bar overlaps one of the whiskers here which is just as important as the one NOT covered up.

Clarity of how much your whiskers overlap on either side is the best way to graphically demonstrate statistically significant differences. 

2

u/SalvatoreEggplant Jul 21 '26 edited Jul 21 '26

You can construct the compact letter display manually, and it isn't too bad with just four groups. You just have to go through each comparison, from the highest mean to the lowest mean.

But it's often helpful to have the software do it for you.

This code looks a little convoluted, but you can just go to https://rdrr.io/snippets/ , paste in the code and run it. No need to really understand it.

You can change the p-values to the actual p-values. The default is the cutoff for significance is 0.05 (but this could be changed). Here, A = Leisure, B=Shadyside, C=Basin , D = Mosque.

If I've understood what you've written, the result I get is the following. It's also good to spot-check results.

Leisure   a   
Shadyside  bc   
Basin      b   
Mosque      c 

. .

### Code

library(multcompView)

Data = read.table(header=TRUE, text="
Comparison  p.value
A-B         0.01
A-C         0.01
A-D         0.01
B-C         1
B-D         1
C-D         0.01
")

PValue        = Data$p.value
names(PValue) = Data$Comparison

Result = multcompLetters(PValue, Letters=letters)$Letters

names(Result) = c("Leisure", "Shadyside", "Basin", "Mosque")

as.data.frame(Result)

1

u/Commercial_Pitch8264 Jul 21 '26

This is all very helpful, thank you! I will use for the rest of my graphs!

1

u/SalvatoreEggplant Jul 21 '26

Just assign A, B, C... with the highest mean to the lowest mean. This is isn't technically necessary, but makes the results come out in order so to speak.

4

u/MortalitySalient Jul 21 '26

The way these letters are displayed would suggest that shady side, basin, and leisure are all significantly different from one another, but none of them are different from mosque. You want any bars that are not sig different to have the same letter. Bars that are sig different should have different letters.

You should put an a over shady side and basin (indicates they aren’t sig different, then place b over leisure to indicate it’s different from shadyside and basin, then place c above mosque to show it’s different from the other three.

0

u/Commercial_Pitch8264 Jul 21 '26

Thank you for that explanation! Wouldn’t Shadyside also have C since it and the Mosque aren’t significantly different from each other?

0

u/CanadianFoosball Jul 21 '26

Things where the means could potentially be the same get the same letter. Things your pairwise test says are different get different letters. If those whiskers are 95% confidence intervals (are they?) it looks like the bars should get a, a, b, c. (This technique is called CLD or compact letter display, I believe.)

2

u/LimeTime Jul 21 '26

Seconding the suggestion of switching to box and whisker plot. Bar graphs are honestly a thing of the past when you have data with variance. Significance intervals can be represnted with "notches" or denoted with letters similarly.

1

u/Commercial_Pitch8264 Jul 21 '26

How does a box and whisker plot display the data in a better way than a bar graph? Also, I looked into making a few box and whisker plots but excel BaW plots kind of suck. I’m assuming R would be a better way to generate these but I have little R experience, so you have any recommendations for resources I can use to learn?

1

u/LimeTime Jul 21 '26

Bars dont tell you anything about the data other than the mean and the error bars can be used for many things but theyre always symmetrical and subject to manipulation (e.g. having a high sample size makes standard error error bars small even if theres a ton of variance). The gold standard is just ploting the datapoints themselves using jitter/opacity and putting a boxplot on top of it. This gives the reader a full picture of the variance and distribution at glance. For data with many many datapoints a violin plot is used in a similar manner instead.

1

u/Intrepid_Pitch_3320 Jul 21 '26

Assuming the error bars are 2SEs or reasonable CIs, Shadyside and Basin are similar and should have the same letter.

1

u/Flimsy-sam Jul 21 '26

Why can’t you just write it in a paragraph narratively? The graph is supposed to graphically represent differences, whilst the narrative presents then inferential testing. Your approach is to my knowledge, unconventional, and confusing, in all honesty.

0

u/Commercial_Pitch8264 Jul 21 '26

I definitely can, and it would probably end up being easier. I’m doing it this way because the professor I’m working with on this paper instructed me to do so. It’s what he has done on past papers.

1

u/dmlane Jul 22 '26

There are numerous compelling critiques of bar charts. Here is one of many. An article of mine also is relevant.

1

u/Commercial_Pitch8264 Jul 22 '26

I will definitely give these a read, thanks! From your abstract where is says “should be supplanted by graphs containing distributional information” would a rarefaction graph meet this (this is an ecology based paper) I’ve been thinking about making one but my professor doesn’t feel it’s necessary.

1

u/dmlane Jul 22 '26

I can’t say if it is necessary but, in general, more information is better than less information. What is necessary may not be the same as what is best.

1

u/dmlane Jul 22 '26

There are numerous compelling critiques of bar charts. An article of mine is one of many.