Announcement

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

  • Stata 17: How to put Confidence Intervals on either "graph bar" or "graph hbar" with Survey Data

    Dear Statalist Users,

    Good morning. I have two quick questions to ask you :
    1. How can we add some confidence intervals to the graph bar or graph hbar type please? I have made a hbar graph type, but I don't know how I can put the corresponding 95% CI here. Please check below.
    2. How can we reduce the size of the blue-navy part of the graph below, and thus increase the space for the "real" graph, please?
    Code:
          graph hbar (mean) belage13 [pw = k_gewicht]             ///                      
          ,over(restricted_field) over(bachelor_hes) nofill       ///        
          blabel(bar,position(outside) size(tiny) format(%15.2f)) ///
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	51.3 KB
ID:	1687819
    ​​​​​​​

    Thank you in advance for your answer and help.

    Best,

    --
    Michael Duarte Gonçalves

  • #2
    Often asked here. In essence, graph bar and graph hbar are no use for your purpose. You need to move to twoway bar to do what you're asking; in fact I would commend just a scatter plot of means with (capped or uncapped) spikes.

    There are community-contributed commands. My personal favourite strategy entails none of those, but statsby.
    https://www.stata-journal.com/articl...article=gr0045

    Comment


    • #3
      Dear Nick,

      Thank you for your answer and suggestions!

      There are community-contributed commands. My personal favourite strategy entails none of those, but statsby.
      https://www.stata-journal.com/articl...article=gr0045
      Thank you also for the paper! I will read it and if I have any questions I will come back and ask them again on Statalist.

      Best wishes,

      --
      Michael Duarte Gonçalves

      Comment


      • #4
        Just to note that the syntax of ci has changed since that paper. You now need a subcommand too.

        Comment

        Working...
        X