本文介绍了输出带边距的变量值标签,dydx()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用dydx()选项时,有没有办法报告变量值标签,而不是Stata的margins命令的默认输出?

例如,当使用margins而不使用dydx()时,输出将使用sex的值标签:

clear
use http://www.stata-press.com/data/r14/margex

regress y i.sex i.group
margins sex

但是,使用dydx()时,值标签消失:

margins, dydx(sex) at(group = (1 2 3))

我找不到可以在margins中设置的任何选项来强制执行此操作。

看起来社区贡献的命令(如esttab)也不会实现此目的。

交叉发布于Statalist

推荐答案

这与at()选项Notdydx()有关。

正确的语法如下:

. margins, dydx(sex) at(1.group 2.group 3.group)  

Conditional marginal effects                    Number of obs     =      3,000
Model VCE    : OLS

Expression   : Linear prediction, predict()
dy/dx w.r.t. : 1.sex
at           : 1.group         =    .3996667 (mean)
               2.group         =    .3726667 (mean)
               3.group         =    .2276667 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         sex |
     female  |   18.32202   .8930951    20.52   0.000     16.57088    20.07316
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

将其与您的语法进行比较:

. margins, dydx(sex) at (group = (1 2 3))

Conditional marginal effects                    Number of obs     =      3,000
Model VCE    : OLS

Expression   : Linear prediction, predict()
dy/dx w.r.t. : 1.sex

1._at        : group           =           1

2._at        : group           =           2

3._at        : group           =           3

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
1.sex        |
         _at |
          1  |   18.32202   .8930951    20.52   0.000     16.57088    20.07316
          2  |   18.32202   .8930951    20.52   0.000     16.57088    20.07316
          3  |   18.32202   .8930951    20.52   0.000     16.57088    20.07316
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.

这篇关于输出带边距的变量值标签,dydx()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 08:20