假设您想要绘制一个回归系数图,其中交互作用是分组和重命名的。下面的示例来自-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 *不会产生所需的结果。
对于我的数据,我也使用了group()选项,所以我想找到一个解决方案,在这个解决方案中,我可以组合标题()和rename()。任何指示都会受到极大的赞赏。
发布于 2015-04-21 15:20:56
使用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)https://stackoverflow.com/questions/29775996
复制相似问题