边距与 lincom/nlcom(在 Stata 中)有多大不同?

To what extent is margins different from lincom/nlcom (in Stata)?

Stata 中的 marginslincom 到底有什么区别?如何调整 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
------------------------------------------------------------------------------

我漏掉了 wks_ue 的平均值。从估计样本中获取,保存为本地并包含在lincom中。系数和标准误差将相同。 lincom 使用 t-distribution 而 margins 使用 z-distribution.

* 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'