2

我正在使用Stata 中的coefplot命令(sourcedocs)绘制类别上连续变量的方法。

可重复的小例子:

sysuse auto, clear
drop if rep78 < 3
la de rep78 3 "Three" 4 "Four" 5 "Five"
la val rep78 rep78

mean mpg if foreign == 0, over(rep78)
eststo Domestic
mean mpg if foreign == 1, over(rep78)
eststo Foreign

su mpg, mean
coefplot Domestic Foreign , xtitle(Mpg) xline(`r(mean)') 

给我结果:

在此处输入图像描述

我想添加的是 Y 轴的额外“组”标签。尝试回归示例中的选项似乎不起作用:

coefplot Domestic Foreign , headings(0.rep78 = "Repair Record 1978")
coefplot Domestic Foreign , groups(?.rep78 = "Repair Record 1978")

还有其他可能吗?

4

1 回答 1

2

这似乎可以完成这项工作

   coefplot Domestic Foreign , xtitle(Mpg) xline(`r(mean)')  ///
      groups(Three Four Five = "Repair Record 1978")

但是我不知道它将如何处理具有相同标签的分类变量的情况?

于 2015-07-02T14:05:07.070 回答