假设您要绘制回归系数图,其中交互都被分组和重命名。遵循-coefplot-论文(2014年1月)中的示例,以下代码允许您对交互进行分组:
* BEGIN *
sysuse auto, clear
keep if rep78>=3
//run regression
quietly regress mpg headroom i.rep78#i.foreign
eststo model
//plot results
coefplot model, ///
xline(0) omitted baselevels ///
headings( 3.rep78#0.foreign = "{bf:Interaction Effects}") ///
drop(_cons)
* END *
并且以下内容使您可以重命名互动(为简洁起见,仅此一个):
* BEGIN *
coefplot model, ///
xline(0) omitted baselevels ///
rename( 3.rep78#0.foreign = "new name") ///
drop(_cons)
* END *
但是结合两种方法
* BEGIN *
coefplot model, ///
xline(0) omitted baselevels ///
rename( 3.rep78#0.foreign = "new name") ///
headings( 3.rep78#0.foreign = "{bf:Interaction Effects}") ///
drop(_cons)
* END *
无法产生预期的结果。
对于我的数据,我也使用groups()选项,因此我想找到一个可以将headings()和named()结合起来的解决方案。任何指针,不胜感激。
使用coeflabels()
选项:
*----- example data -----
sysuse auto, clear
keep if rep78>=3
//run regression
quietly regress mpg headroom i.rep78#i.foreign
eststo model
*----- what you want -----
coefplot model, ///
xline(0) omitted baselevels ///
coeflabels(3.rep78#0.foreign = "new name") ///
headings(3.rep78#0.foreign = "{bf:Interaction Effects}") ///
drop(_cons)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句