为什么 coefplot 没有在 Stata 中绘制所有级别的交互?

发布于 2025-01-12 20:17:43 字数 1086 浏览 0 评论 0原文

我想将此回归的系数绘制为森林图。

-------------------------------------------------------------------------------
        price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
foreign#rep78 |
  Domestic#1  |   -781.769   1013.428    -0.77   0.443    -2805.724    1242.186
   Foreign#0  |  -1529.739   1771.487    -0.86   0.391    -5067.642    2008.164
   Foreign#1  |  -81.34985   848.0347    -0.10   0.924    -1774.992    1612.292
              |
        _cons |   6358.405   485.1416    13.11   0.000     5389.511      7327.3
-------------------------------------------------------------------------------

由 coefplot(社区贡献的命令)生成的森林图仅绘制最后一个系数 (-81),而不绘制其他系数(-782 和 -1530)。我哪里错了?

sysuse auto, clear

recode rep78 (1/3=0) (4/5=1)
    
reg price i.foreign#i.rep78

* Only plots last coefficient (-81)
coefplot, keep(*.foreign#*.rep78) mlabel

* Doesn't work either
coefplot, keep(0.foreign#1.rep78 1.foreign#0.rep78 1.foreign#1.rep78) mlabel

I want to plot the coefficients from this regression as a forest plot.

-------------------------------------------------------------------------------
        price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
foreign#rep78 |
  Domestic#1  |   -781.769   1013.428    -0.77   0.443    -2805.724    1242.186
   Foreign#0  |  -1529.739   1771.487    -0.86   0.391    -5067.642    2008.164
   Foreign#1  |  -81.34985   848.0347    -0.10   0.924    -1774.992    1612.292
              |
        _cons |   6358.405   485.1416    13.11   0.000     5389.511      7327.3
-------------------------------------------------------------------------------

The forest plot produced by coefplot (community-contributed command) only plots the last coefficient (-81), and not the other coefficients (-782 and -1530). Where am I going wrong?

sysuse auto, clear

recode rep78 (1/3=0) (4/5=1)
    
reg price i.foreign#i.rep78

* Only plots last coefficient (-81)
coefplot, keep(*.foreign#*.rep78) mlabel

* Doesn't work either
coefplot, keep(0.foreign#1.rep78 1.foreign#0.rep78 1.foreign#1.rep78) mlabel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧竹 2025-01-19 20:17:43

coefplot 自动排除标记为“省略”或“基本水平”的系数——就像您的系数一样。要在图中包含所有系数,您应该指定“省略”和“基本水平”选项。所以它看起来像这样:

sysuse auto, clear
recode rep78 (1/3=0) (4/5=1)
reg price i.foreign#i.rep78
coefplot, omitted baselevels mlabel

有关该包的更多详细信息可在此处找到: http://repec.sowi.unibe.ch/stata/coefplot/getting-started.html

coefplot automatically excludes coefficients that are flagged as "omitted" or as "base levels"---as in the case of your coefficients. To include all coefficients in the plot, you should specify the "omitted" and "baselevels" options. So it would look like something along these lines:

sysuse auto, clear
recode rep78 (1/3=0) (4/5=1)
reg price i.foreign#i.rep78
coefplot, omitted baselevels mlabel

Some more details on the package are available here: http://repec.sowi.unibe.ch/stata/coefplot/getting-started.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文