Announcement

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

  • Adding Confidence Intervals to Bar Plot showing percentages

    Hi,

    I want to create a percentage bar graph showing education level by gender. However, I cannot add confidence intervals to it. If I use this guide: https://www.stata-journal.com/sjpdf....iclenum=gr0045, I am able to get the means. However, I cannot modify it to include percentages. Similarly, I have followed the thread: https://www.statalist.org/forums/for...dence-interval. This has also failed.

    I tried catplot and it failed to work.

    The code:

    Code:
    catplot gender education, percent(gender) recast(bar) var2opts(label(labsize(small) angle(90))) asyvars bargap(5) blabel(bar , format(%4.1f))
    Example of the dataset
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(gender education)
    1 4
    1 4
    1 5
    1 5
    1 3
    1 2
    1 1
    1 4
    1 4
    1 2
    1 3
    1 5
    1 4
    1 3
    1 5
    1 4
    1 2
    1 3
    1 3
    1 4
    1 2
    1 2
    1 4
    1 3
    1 5
    1 2
    1 4
    1 4
    1 5
    1 2
    1 4
    1 4
    1 2
    1 4
    1 5
    1 3
    1 4
    1 5
    1 1
    1 3
    1 4
    1 3
    1 4
    1 1
    1 4
    0 3
    0 4
    0 3
    0 2
    0 4
    0 2
    0 4
    0 4
    0 5
    0 1
    0 5
    0 5
    0 3
    0 5
    0 4
    0 4
    0 4
    0 1
    0 2
    0 2
    0 5
    0 5
    0 1
    0 3
    0 4
    0 3
    0 5
    0 4
    0 4
    0 4
    0 4
    0 3
    0 4
    0 5
    0 2
    0 3
    0 5
    0 4
    0 3
    0 4
    0 4
    0 4
    0 1
    0 1
    0 3
    0 3
    0 5
    0 4
    0 2
    0 2
    0 2
    0 3
    0 1
    0 2
    0 3
    end

  • #2
    That catplot (from SSC, as you are asked to explain) "failed to work" seems to mean that it doesn't purport to produce confidence intervals at all. That cat doesn't pretend to be a dog.

    A bigger deal here is that I miss any sense of how you want confidence intervals to be calculated. Suppose gender is taken as given in this context. Then you could calculate e.g. confidence intervals for the proportion of "gender 0" who have reached education level 4, and so on. But that treats each proportion separately and I am not clear that that would be good analysis, or what is obviously better.

    Comment

    Working...
    X