问题
Currently, I have the following code:
sysuse auto, clear
estimates clear
gen year=.
replace year=1988 if foreign==0
replace year=1989 if foreign==1
regress price mpg trunk length turn if year==1988
estimates store Year1988
regress price mpg trunk length turn if year==1989
estimates store Year1989
coefplot Year1988 Year1989, vertical keep(trunk) xline(0) xlabel("")
This generates:
However, I want to put custom names for each stored regression set of results like:
How can I do this? I tried xtick
and xlabel
but it doesn't work.
Note: Answer without vertical
option can be found here.
回答1:
The idea is the same:
sysuse auto, clear
estimates clear
gen year=.
replace year=1988 if foreign==0
replace year=1989 if foreign==1
regress price mpg trunk length turn if year==1988
estimates store Year1988
regress price mpg trunk length turn if year==1989
estimates store Year1989
local gap1 : display _dup(45) " "
local gap2 : display _dup(40) " "
coefplot Year1988 Year1989, vertical keep(trunk) xline(0) ///
coeflabels(trunk = `""|`gap1'|""1988`gap2'1989""') ///
xlabel(, notick labgap(0)) xline(0) legend(off)
来源:https://stackoverflow.com/questions/54409440/coefplot-putting-names-of-regressions-with-vertical-option