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:
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)
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:
- Grouping the dependent variables correctly so that they appear only once on the y-axis, while showing separate estimates for males and females.
- Formatting the coefplot to align with the structure of my reference Figure (attached). Figure source: https://navaashraf.com/wp-content/up...tunities-1.pdf
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)

Comment