我使用以下数据绘制带有置信度限制的估计值:
clear
input year beta ci5 ci95 pvalue
1999 0.390337619 -0.876345001 1.657020238 0.527644768
2001 -0.281463106 -1.14277483 0.579848618 0.503264501
2003 -0.753077604 -1.49646223 -0.009692978 0.047349224
2005 -0.295911126 -0.735095768 0.143273516 0.175219436
2007 0.976340177 0.206120956 1.746559398 0.015560029
2010 0.080218534 -0.428463191 0.588900259 0.745605829
2012 0.021721372 -0.61379414 0.657236884 0.943868989
2014 -0.05203667 -0.658245394 0.554172054 0.859691155
end
我这样做是使用 community-contributed 命令eclplot
,而我运行的代码如下:
eclplot beta ci5 ci95 year, eplot(bar) estopts(barwidth(0.25)) title("Portfolio") ///
rplottype( rspike) estopts2(bcolor(black)) ytitle("alpha (b.p.)") xtitle(" years") ///
yline(0,lstyle(foreground)) xline(2007, lcolor(blue))
如何在相应条上方添加p值?
我还想绘制2007
年的粗参考线(浅灰色)。
答案 0 :(得分:2)
以下对我有用:
generate a = 2
generate b = round(pvalue, .001)
levelsof year, local(allyears) clean
eclplot beta ci5 ci95 year, eplot(bar) estopts(barwidth(0.25)) ///
title("Portfolio") rplottype( rspike) estopts2(bcolor(black)) ///
ytitle("alpha (b.p.)") xtitle("years") yline(0,lstyle(foreground)) ///
xline(2007, lcolor(gs9) lwidth(thick)) addplot(scatter a year, mlabel(b) ///
msymbol(i) mlabposition(6)) xlabel(`allyears')