如何执行Sargan-Hansen测试

时间:2019-04-24 09:29:13

标签: statistics stata

我正在运行固定效果面板回归,并想测试工具的有效性:

xtivreg deltahealth years years2 marpart logass logdebt smokesn vigact3 i.time ///
        (RS RL = betw6265 under62 eps1 eps2 eps1u62 eps2b6265), fe vce(cluster idhhpn)

xtoverid

但是,这不起作用,因为我得到以下错误:

  

2b:运算符无效

如何解决此问题?

1 个答案:

答案 0 :(得分:3)

社区贡献命令xtoverid不支持因子变量表示法。

但是,您可以首先使用fvrevar命令进行连续变量和虚拟变量的前缀xi的交互:

. webuse nlswork, clear
  (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

. tsset idcode year
       panel variable:  idcode (unbalanced)
        time variable:  year, 68 to 88, but with gaps
                delta:  1 unit

. fvrevar c.age#c.age

. xi: xtivreg ln_w age `r(varlist)' not_smsa (tenure = union south), fe

Fixed-effects (within) IV regression            Number of obs     =     19,007
Group variable: idcode                          Number of groups  =      4,134

R-sq:                                           Obs per group:
     within  =      .                                         min =          1
     between = 0.1304                                         avg =        4.6
     overall = 0.0897                                         max =         12

                                                Wald chi2(4)      =  147926.58
corr(u_i, Xb)  = -0.6843                        Prob > chi2       =     0.0000

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      tenure |   .2403531   .0373419     6.44   0.000     .1671643    .3135419
         age |   .0118437   .0090032     1.32   0.188    -.0058023    .0294897
    __000000 |  -.0012145   .0001968    -6.17   0.000    -.0016003   -.0008286
    not_smsa |  -.0167178   .0339236    -0.49   0.622    -.0832069    .0497713
       _cons |   1.678287   .1626657    10.32   0.000     1.359468    1.997106
-------------+----------------------------------------------------------------
     sigma_u |  .70661941
     sigma_e |  .63029359
         rho |  .55690561   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F  test that all u_i=0:     F(4133,14869) =     1.44      Prob > F    = 0.0000
------------------------------------------------------------------------------
Instrumented:   tenure
Instruments:    age __000000 not_smsa union south
------------------------------------------------------------------------------

命令xtoverid将按预期工作:

. xtoverid

Test of overidentifying restrictions: 
Cross-section time-series model: xtivreg fe   
Sargan-Hansen statistic   1.372  Chi-sq(1)    P-value = 0.2415