0

marginsStata和Stata之间到底有什么区别lincom?如何调整我的手动公式nlcom以匹配结果margins?谢谢

* load data
use http://www.stata-press.com/data/r13/nlswork

* set panel structure
xtset idcode year

* fixed effects regression 
xtreg ln_wage c.wks_ue##c.wks_ue union age, fe coeflegend
margins, dydx(wks_ue)
------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      wks_ue |    -.00594   .0009744    -6.10   0.000    -.0078497   -.0040303
------------------------------------------------------------------------------

* check with lincom/nlcom
lincom _b[wks_ue] + 2*_b[c.wks_ue#c.wks_ue]
nlcom _b[wks_ue] + 2*_b[c.wks_ue#c.wks_ue]

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _nl_1 |  -.0062406   .0010319    -6.05   0.000    -.0082632   -.0042181
------------------------------------------------------------------------------
4

1 回答 1

2

我错过了 的平均值wks_ue。从估计的样本中获取它,将其保存为本地并将其包含在lincom. 系数和标准误差将是相同的。lincom使用 t 分布并margins使用 z 分布。

* load data
use http://www.stata-press.com/data/r13/nlswork

* set panel structure
xtset idcode year

* fixed effects regression 
xtreg ln_wage c.wks_ue##c.wks_ue union age, fe coeflegend
margins, dydx(wks_ue)

qui sum wks_ue if e(sample)
local wks_ue_mean = r(mean)

lincom wks_ue + 2*c.wks_ue#c.wks_ue*`wks_ue_mean' 

在此处输入图像描述

于 2020-08-26T06:39:14.213 回答