I am running two regressions with the same independent variable but different dependent variable twice, one with no control variables and one with all control variables. My code is as follows:
Code:
reg yvar1 xvar
estimate store yvar1_nocontrols
reg yvar2 xvar
estimate store yvar2_nocontrols
And the following two regressions with control variables:
Code:
reg yvar1 xvar control1 control2 control3
estimate store yvar1_allcontrols
reg yvar2 xvar control1 control2 control3
estimate story yvar2_allcontrols
I want to create a coefficient plot which compares for each yvar1 and yvar the different impact of xvar when using no control variables and when using all control variables. I have been using the following command:
Code:
coefplot (yvar1_nocontrols, label(ABC)) (yvar1_allcontrols, label(ABC)) (yvar2_nocontrols, label (DEF)) (yvar2_allcontrols, label (DEF)) ||, vertical keep(xvar) yline(0) coeflabels(did = "XVAR")
Yet, with this command it seems like the four coefficients come from different regressions (there are four different points in the legend). Moreover, the legend has "ABC" and "DEF" twice, while I want ABC and DEF to be in the x axis and the legend to have two options: "No controls" and "All controls".
Does anyone know how can I amend the above command to achieve this?
Thank you very much in advance!
0 Response to Coefplot merging coefficients of multiple regressions by category
Post a Comment