No announcement yet.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bar graphs with brackets to indicate statistical significance

    Dear statalist members,

    I would like to produce a bar graph with the (mean) differences for two different variables between two treatment groups. Producing this graph is not a problem; however, I would like to indicate the statistical significance of the (mean) differences between the treatments for each variable by using brackets and some text_options (?) (i.e., n.s. or the corresponding asterisks and/or the p-values). I attached two exemplary bar graphs, which I found online from other forums.

    How can I modify the following code to insert such brackets?
    graph bar variable_a variable_b, over(treatment) ///
    legend(label(1 "aa") label(2 "bb")) ///

    I would greatly appreciate any help on this.

    Many thanks and best,
    Attached Files
    I use a bar graph to indicate the data of each group. Some of these bars differ significantly from each other. How can I indicate the significant difference in the bar plot? import numpy as np imp...

  • #2
    You won't be able to do this using the graph command but with some work, you can do it with twoway. See the following:


    • #3
      Dear Andrew,

      thank you very much for your suggestion. I eventually decided to update the figure with the free vectors graphic editor Inkscape.