I'm using -coefplot- to create a graph showing the balance between covariates for a treatment and control group. I separately regress each covariate on the treatment variable, and store the estimate to plot. Important to my solution is that I can control the names along the y-axis like in my example below.
Note: I standardize the data so coefficients are comparable across regressions.
Here is a simple example:
Code:
// In this example, I check whether random covariates are balanced across foreign vs. domestic cars
sysuse auto, clear
eststo clear
local variables price mpg headroom trunk
foreach var of local variables {
egen `var'_std = std(`var')
eststo: reg `var'_std foreign
}
coefplot ///
(est1, rename(foreign = "outcome1")) ///
(est2, rename(foreign = "outcome2")) ///
(est3, rename(foreign = "outcome3")) ///
(est4, rename(foreign = "outcome4")), ///
drop(_cons) xline(0) legend(off) ///
coeflabel(outcome1 = "Some name" outcome2 = "A different name" outcome3 = "Third name" outcome4 = "Final name")I thought this would be something easy to solve by searching Statalist but I was unsuccessful in finding a solution. Any assistance would be appreciated. Thanks!
0 Response to coefplot: how to align y-axis and markers?
Post a Comment