我用了一个笨办法:
首先,把要omit的变量放到一组完全线性相关变量的最后,这样跑回归时就会把它自动omit掉;
然后,在coefplot时使用order和omitted这两个option,将变量按照理想顺序排好。
比如我为了让bpost1_y2020在系数图中作为参考,需要在回归中omit bpost1_y2020这个变量,
reg $y y2020 bpost4 bpost3 bpost2 bpost1 apost0 ... apost14 ///
bpost4_y2020 bpost3_y2020 bpost2_y2020 /*bpost1_y2020*/ /// omit one week before newyear
apost0_y2020 ... apost14_y2020 bpost1_y2020 ///
$control
调用回归系数作图时,理想的系数顺序是“bpost4_y2020 ... bpost1_y2020 apost0_y2020 ... apost14_y2020”;但因为reg中把bpost1放在了最后,如果不调整系数(或者说变量)顺序,则图中出现的顺序会是“bpost4_y2020 ... apost0_y2020 ... apost14_y2020 bpost1_y2020”,
coefplot, baselevels ///
drop(... ) ///
order( ///
bpost4_y2020 ="-4" ///
bpost3_y2020 ="-3" ///
bpost2_y2020 ="-2" ///
bpost1_y2020 ="-1" ) ///
coeflabels( ///
bpost4_y2020 ="-4" ///
bpost3_y2020 ="-3" ///
....
apost14_y2020 ="14" ) /// 更改系数的label ///
omitted /// 使图中包括被omited的年前一周
vertical


雷达卡






京公网安备 11010802022788号







