coefplot: Putting names of regressions with vertical option

前提是你 提交于 2019-12-11 16:16:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!