【问题标题】:To what extent is margins different from lincom/nlcom (in Stata)?边距与 lincom/nlcom(在 Stata 中)有何不同?
【发布时间】:2020-08-25 15:30:55
【问题描述】:

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

【问题讨论】:

  • 确实,我对lincom 的一行很感兴趣,它使结果等同于margins。谢谢

标签: regression stata marginal-effects


【解决方案1】:

我错过了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' 

【讨论】:

    猜你喜欢
    • 2021-11-10
    • 1970-01-01
    • 2016-08-04
    • 2018-01-07
    • 2013-12-25
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 2011-01-12
    相关资源
    最近更新 更多