Announcement

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

  • Treatment effects Coefplot

    Hello Statalist,


    I am trying to create a coefplot where the results for males and females appear side by side for each outcome variable, similar to the attached example graph. I am running separate regressions for each gender and storing the results, then using coefplot to visualize the estimates. However, I am struggling with:
    1. Grouping the dependent variables correctly so that they appear only once on the y-axis, while showing separate estimates for males and females.
    2. Formatting the coefplot to align with the structure of my reference Figure (attached). Figure source: https://navaashraf.com/wp-content/up...tunities-1.pdf
    I tried the following code but it is not giving me what i want.
    local outcomes var1 var2 var3 var4
    foreach outcome of local outcomes {
    * Run regression for females (female == 1)
    reg `outcome' treatment $con if female == 1
    estimates store `outcome'_female

    * Run regression for males (female == 0)
    reg `outcome' treatment $con if female == 0
    estimates store `outcome'_male
    }
    * Generate coefplot
    graph set window fontface "Times New Roman"

    coefplot (var1_female var2_female var3_female var4_female, ///
    label("Female") msymbol(D) color(orange)) ///
    (var1_male var2_male var3_male var4_male, ///
    label("Male") msymbol(D) color(purple)), ///
    drop(_cons) ///
    xline(0, lpattern(dash)) ///
    ylabels(, angle(0) labsize(small)) ///
    xlabel(-0.3(0.1)0.3, grid format(%4.2f)) ///
    swapnames aseq ///
    legend(order(1 "Female" 2 "Male")) ///
    name(c, replace)

    Attached Files

  • #2
    please help me

    Comment


    • #3
      A few comments: For what you are asking, you will increase your chances of obtaining helpful replies by enclosing a reproducible example (see FAQ Advice #12 for details). In addition, you should show your desired figure in .PNG format, as recommended in the same FAQ Advice. Note that coefplot is from SSC.

      Comment


      • #4
        Reposted and answered here: https://www.statalist.org/forums/for...ot-please-help

        Comment

        Working...
        X