Stata:机器学习分类器大全

发布时间:2021-01-07 阅读 648

Stata连享会   主页 || 视频 || 推文 || 知乎

温馨提示: 定期 清理浏览器缓存,可以获得最佳浏览体验。

New! lianxh 命令发布了:
随时搜索连享会推文、Stata 资源,安装命令如下:
. ssc install lianxh
使用详情参见帮助文件 (有惊喜):
. help lianxh

课程详情 https://gitee.com/arlionn/Course   |   lianxh.cn

课程主页 https://gitee.com/arlionn/Course

作者: 谢雁翔 (南开大学)
邮箱: xyxmask1995@163.com

编者按: 本文主要参考「Sebastian Kripfganz」 的如下内容,特此致谢!

Source: Kripfganz S . XTDPDGMM: Stata module to perform generalized method of moments estimation of linear dynamic panel data models[J]. Statistical Software Components, 2019. -Link-

Kripfganz S . Generalized method of moments estimation of linear dynamic panel-data models[C]. London Stata Conference 2019. Stata Users Group, 2019. -Link-


目录


1. 简介

对于动态面板数据模型 (Dynamic Panel Data, DPD),直接用最小二乘法估计是有偏的,为解决这一问题,Arellano 和 Bond (1991)、 Arellano 和 Bover (1995)、以及 Blundell 和 Bond (1998) 等提出了「一阶差分 GMM (FD-GMM)」和「系统 GMM (SYS-GMM)」估计法。

相应地,Stata 也提供了 xtabondxtdpdsys、以及 xtabond2 等早期估计 GMM 的命令。Kripfganz (2019) 在此基础上,编写了 xtdpdgmm 命令,该命令解决了 xtabond2 等命令的一些缺陷,并使估计更加灵活。特别的,该命令整合了 Ahn 和 Schmidt (1995) 非线性矩条件、更好解决了高度自相关问题、以及提供了 Hansen 等 (1996) 的迭代 GMM 估计。

本文的主要目的是介绍动态面板数据模型的两种估计方法,以及 xtdpdgmm 命令的应用。

2. 估计方法

2.1 差分 GMM

考虑以下动态面板模型:

通过一阶差分消去个体效应 ui,可得:

然而,由于 yi,t1 与 εi,t1 相关, 使得 Δyi,t1yi,t1yi,t2 与 Δεitεitεi,t1 相关。也因此,Δyi,t1 为内生变量,我们需要为其找到适当的工具变量才能得到一致估计。

为此,Anderson 和 Hsiao (1981) 认为由于 yi,t2 与 Δyi,t1=yi,t1yi,t2 相关,若 {εit} 不存在自相关,则 yi,t2 与 Δεit=εitεi,t1 不相关,故 yi,t2 是 Δyi,t1 的有效工具变量。根据这一思想,更高阶的滞后变量 {yi,t3,yi,t4,} 也是有效工具变量,但是 Anderson 和 Hsiao (1981) 估计并未加以利用,所以估计并非最有效。

Arellano 和 Bond (1991) 使用所有可能的滞后变量作为工具变量 (工具变量个数可能多于内生变量) 进行估计,这一方法又被称为「差分 GMM」。值得注意的是,在使用差分 GMM 时,扰动项 {εit} 不存在自相关,即 Cov(εit,εis)=0

差分 GMM 注意事项:

  • 如果 xit 非严格外生,即虽然 xit 与当期 εit 不相关,但与 εi,t1 相关,则 Δxit=xitxi,t1 与 Δεit=εitεi,t1 相关,使得 Δxit 为内生变量。此时,可以使用  {xi,t1,xi,t2,} 作为 Δxit 的工具变量。

  • 如果 T 很大,则会有很多工具变量,进而容易产生弱工具变量问题。同时,也会弱化 Hansen 统计量,甚至出现 p 值等于 1 的不可信结果。解决方法一是在使用 xtabond 命令时,限制最多使用 q 阶滞后变量作为工具变量。方法二是使用折叠的 Ⅳ 式工具变量,而不使用展开的 GMM 式工具变量。

  • 不随时间变化的变量 zi 被消掉了,故差分 GMM 无法估计 zi 的系数。

  • 如果序列 |yi| 具有很强的持续性,即一阶自回归系数接近于 1,则  yi,t2 与 Δyi,t1yi,t1yi,t2 的相关性可能很弱,进而导致弱工具变量问题。

2.2 水平 GMM

为克服上述差分 GMM 将不随时间变化的变量 zi 消掉、以及序列 |yi| 具有很强的持续性等问题,Arellano 和 Bover(1995) 重新回到了差分之前的水平方程,并使用 {Δyi,t1,Δyi,t2,} 作为 yi,t1 的工具变量。但前提是需假设 {εit} 不存在自相关,以及 {Δyi,t1,Δyi,t2,} 与个体效应 ui 不相关。上述过程也被称为「水平 GMM」。

2.3 系统 GMM

Blundell 和 Bond (1998) 将差分 GMM 与水平 GMM 联合进行 GMM 估计,即「系统 GMM」。与差分 GMM 相比,系统 GMM 的优点是,可以提高估计的效率,并且可以估计不随时间变化的变量 zi 的系数。其缺点是,必须假定 {Δyi,t1,Δyi,t2,} 与 ui 无关。

Note:本部分内容摘自「陈强. 高级计量经济学及 Stata 应用[M]. 高等教育出版社, 2014. -Link-」,详见 289-291 页,特此感谢!

3. xtdpdgmm 命令介绍

3.1 xtdpdgmm 命令语法

xtdpdgmm 命令的安装:

ssc install xtdpdgmm, replace  

xtdpdgmm 命令的语法:

 xtdpdgmm depvar [indepvars] [if] [in] [, options]

其中,option 具体选项如下:

  • iv(iv_spec):指定标准式工具变量,并可指定任意多次;
  • gmmiv(gmmiv_spec):指定 GMM 式工具变量,并可指定任意多次;
  • nl (nl_spec):添加由误差协方差结构得出的非线性矩条件;
  • collapse:折叠式工具变量为标准式工具变量;
  • model(model_spec):设置工具变量的默认形式及标准误;
  • norescale:不重新缩放转换后的矩条件;
  • wmatrix(wmat_spec):指定用于获得一阶 GMM 估计或两步 GMM 估计的初始估计的加权矩阵;
  • onestep|twostep:确定一步估计或两步估计;
  • igmm:使用迭代 GMM 估计;
  • teffects:模型增加时间效应;
  • overid:计算简化模型的过度识别统计信息;
  • noconstant:无常数项;
  • vce(vce_spec):设置聚类标准误的估计方式进行稳健标准误估计;
  • auxiliary:显示所有系数作为辅助参数;
  • level(#):设置置信区间,默认为水平为 95%;
  • small:进行自由度调整并报告小样本统计数据;
  • coeflegend:显示图例而不是统计信息;
  • noheader:不显示输出表头;
  • notable:不显示输出系数表;
  • nofootnote:不显示系数表下脚注;
  • display_options:控制列和列的格式,行间距,行宽,需要省略的变量以及基础空白单元格、因子变量的标记;
  • noanalytic:不使用解析封闭解。
  • from(init_spec):确定系数的初始值;
  • nodots:在迭代 GMM 估计中的每个步骤中显示迭代日志,而不是点;
  • igmm_options:控制迭代的 GMM 过程;
  • minimize_options:控制最小化过程。

3.2 xtdpdgmm 命令实操

以 abdata.dta 数据集为例,该数据集是 140 个国家 1976 年到 1984 年的各种宏观指标的面板数据。id 代表每个国家的标号,year 代表年份,其他变量包括就业率 emp、平均工资 wage、投资占 GDP 的百分比 cap 等。

*数据下载地址:https://gitee.com/arlionn/data/blob/master/data01/abdata.dta
*use abdata.dta, clear
webuse abdata     //调用网络数据
describe          //数据结构
sum               //描述性统计
xtset id year     //声明面板数据

一阶差分 GMM 估计:

xtdpdgmm L(0/1).n w k, model(diff) gmm(n, lag(2 .)) gmm(w, lag(1 .)) gmm(k, lag(. .)) nocons  
note: standard errors may not be valid

Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  .01960406

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =     126      Obs per group:    min =         6
                   nonlinear =       0                        avg =  6.364286
                       total =     126                        max =         8

------------------------------------------------------------------------------
          n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          n |
        L1. |   .4144164   .0341502    12.14   0.000     .3474833    .4813495
            |
          w |  -.8292293   .0588914   -14.08   0.000    -.9446543   -.7138042
          k |   .3929936   .0223829    17.56   0.000     .3491239    .4368634
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
1, model(diff):
  1978:L2.n 1979:L2.n 1980:L2.n 1981:L2.n 1982:L2.n 1983:L2.n 1984:L2.n
  1979:L3.n 1980:L3.n 1981:L3.n 1982:L3.n 1983:L3.n 1984:L3.n 1980:L4.n
  1981:L4.n 1982:L4.n 1983:L4.n 1984:L4.n 1981:L5.n 1982:L5.n 1983:L5.n
  1984:L5.n 1982:L6.n 1983:L6.n 1984:L6.n 1983:L7.n 1984:L7.n 1984:L8.n
2, model(diff):
  1978:L1.w 1979:L1.w 1980:L1.w 1981:L1.w 1982:L1.w 1983:L1.w 1984:L1.w
  1978:L2.w 1979:L2.w 1980:L2.w 1981:L2.w 1982:L2.w 1983:L2.w 1984:L2.w
  1979:L3.w 1980:L3.w 1981:L3.w 1982:L3.w 1983:L3.w 1984:L3.w 1980:L4.w
  1981:L4.w 1982:L4.w 1983:L4.w 1984:L4.w 1981:L5.w 1982:L5.w 1983:L5.w
  1984:L5.w 1982:L6.w 1983:L6.w 1984:L6.w 1983:L7.w 1984:L7.w 1984:L8.w
3, model(diff):
  1978:F6.k 1978:F5.k 1979:F5.k 1978:F4.k 1979:F4.k 1980:F4.k 1978:F3.k
  1979:F3.k 1980:F3.k 1981:F3.k 1978:F2.k 1979:F2.k 1980:F2.k 1981:F2.k
  1982:F2.k 1978:F1.k 1979:F1.k 1980:F1.k 1981:F1.k 1982:F1.k 1983:F1.k
  1978:k 1979:k 1980:k 1981:k 1982:k 1983:k 1984:k 1978:L1.k 1979:L1.k
  1980:L1.k 1981:L1.k 1982:L1.k 1983:L1.k 1984:L1.k 1978:L2.k 1979:L2.k
  1980:L2.k 1981:L2.k 1982:L2.k 1983:L2.k 1984:L2.k 1979:L3.k 1980:L3.k
  1981:L3.k 1982:L3.k 1983:L3.k 1984:L3.k 1980:L4.k 1981:L4.k 1982:L4.k
  1983:L4.k 1984:L4.k 1981:L5.k 1982:L5.k 1983:L5.k 1984:L5.k 1982:L6.k
  1983:L6.k 1984:L6.k 1983:L7.k 1984:L7.k 1984:L8.k

差分 GMM 两步估计:

xtdpdgmm L(0/1).n w k, model(diff) gmm(n, lag(2 .)) gmm(w, lag(1 .)) gmm(k, lag(. .)) nocons two vce(r) nofootnote  
Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  .01960406
Step 2         f(b) =  .90967907

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =     126      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =     126                        max =         8

                                   (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
             |              WC-Robust
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         L1. |   .4126102   .0740255     5.57   0.000     .2675228    .5576976
             |
           w |  -.8271943   .0944749    -8.76   0.000    -1.012362   -.6420268
           k |   .3931545   .0484993     8.11   0.000     .2980975    .4882114
------------------------------------------------------------------------------
*序列相关检验
estat serial
Arellano-Bond test for autocorrelation of the first-differenced residuals
H0: no autocorrelation of order 1:     z =   -3.8127   Prob > |z|  =    0.0001
H0: no autocorrelation of order 2:     z =   -0.8686   Prob > |z|  =    0.3851
*过度识别检验
estat overid
Sargan-Hansen test of the overidentifying restrictions
H0: overidentifying restrictions are valid

2-step moment functions, 2-step weighting matrix       chi2(123)   =  127.3551
                                                       Prob > chi2 =    0.3757

2-step moment functions, 3-step weighting matrix       chi2(123)   =  127.6358
                                                       Prob > chi2 =    0.3691

差分 GMM 与系统 GMM 对比:

*差分 GMM
xtdpdgmm L(0/1).n w k, model(diff) collapse gmm(n, lag(2 4)) gmm(w, lag(1 3))  gmm(k, lag(0 2)) nocons two vce(r)
estat serial, ar(1/3)
estat overid

*系统 GMM
xtdpdgmm L(0/1).n w k, model(diff) collapse gmm(n, lag(2 4)) gmm(w k, lag(1 3))  gmm(n, lag(1 1) diff model(level)) gmm(w k, lag(0 0) diff model(level)) two vce(r)
estat serial, ar(1/3)
estat overid
Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =   .0006272
Step 2         f(b) =  .08562737

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =       9      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =       9                        max =         8

                                   (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
             |              WC-Robust
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         L1. |   .3564619   .1074848     3.32   0.001     .1457956    .5671281
             |
           w |  -1.432958   .2141048    -6.69   0.000    -1.852595    -1.01332
           k |   .2860594   .0541221     5.29   0.000     .1799821    .3921367
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
 1, model(diff):
   L2.n L3.n L4.n
 2, model(diff):
   L1.w L2.w L3.w
 3, model(diff):
   k L1.k L2.k

Arellano-Bond test for autocorrelation of the first-differenced residuals
H0: no autocorrelation of order 1:     z =   -2.6865   Prob > |z|  =    0.0072
H0: no autocorrelation of order 2:     z =   -0.9414   Prob > |z|  =    0.3465
H0: no autocorrelation of order 3:     z =   -0.3256   Prob > |z|  =    0.7447

Sargan-Hansen test of the overidentifying restrictions
H0: overidentifying restrictions are valid

2-step moment functions, 2-step weighting matrix       chi2(6)     =   11.9878
                                                       Prob > chi2 =    0.0622

2-step moment functions, 3-step weighting matrix       chi2(6)     =   12.8283
                                                       Prob > chi2 =    0.0458
Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  .00285146
Step 2         f(b) =  .11568719

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =      13      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =      13                        max =         8

                                   (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
             |              WC-Robust
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         L1. |   .5117523   .1208484     4.23   0.000     .2748937    .7486109
             |
           w |  -1.323125   .2383451    -5.55   0.000    -1.790273    -.855977
           k |   .1931365   .0941343     2.05   0.040     .0086367    .3776363
       _cons |   4.698425   .7943584     5.91   0.000     3.141511    6.255339
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
 1, model(diff):
   L2.n L3.n L4.n
 2, model(diff):
   L1.w L2.w L3.w L1.k L2.k L3.k
 3, model(level):
   L1.D.n
 4, model(level):
   D.w D.k
 5, model(level):
   _cons

Arellano-Bond test for autocorrelation of the first-differenced residuals
H0: no autocorrelation of order 1:     z =   -3.3341   Prob > |z|  =    0.0009
H0: no autocorrelation of order 2:     z =   -1.2436   Prob > |z|  =    0.2136
H0: no autocorrelation of order 3:     z =   -0.1939   Prob > |z|  =    0.8462

Sargan-Hansen test of the overidentifying restrictions
H0: overidentifying restrictions are valid

2-step moment functions, 2-step weighting matrix       chi2(9)     =   16.1962
                                                       Prob > chi2 =    0.0629

2-step moment functions, 3-step weighting matrix       chi2(9)     =   13.8077
                                                       Prob > chi2 =    0.1293

3.3 各估计方式呈现

具有严格外生变量的 Anderson-Hsiao IV 估计:

xtdpdgmm L(0/1).n w k, iv(L2.n w k, d) m(d) nocons
xtdpdgmm L(0/1).n w k, iv(L2.n) iv(w k, d) m(d) nocons
note: standard errors may not be valid

Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  1.000e-32

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =       3      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =       3                        max =         8

------------------------------------------------------------------------------
            n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
            n |
          L1. |   .1512874   .1313926     1.15   0.250    -.1062374    .4088122
              |
            w |  -.5149142   .0512699   -10.04   0.000    -.6154013   -.4144271
            k |   .4141651   .0468689     8.84   0.000     .3223038    .5060264
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
  1, model(diff):
    D.L2.n D.w D.k
note: standard errors may not be valid

Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  3.096e-32

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =       3      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =       3                        max =         8

------------------------------------------------------------------------------
            n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
            n |
          L1. |   1.093635   .1414757     7.73   0.000      .816348    1.370922
              |
            w |  -.5565656   .0762891    -7.30   0.000    -.7060895   -.4070417
            k |   .1353903   .0560407     2.42   0.016     .0255525    .2452282
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
  1, model(diff):
    L2.n
  2, model(diff):
    D.w D.k

具有严格外生变量和工具变量约束的 Arellano-Bond 一步 GMM 估计:

xtdpdgmm L(0/1).n w k, gmm(L.n, l(1 4) c) iv(w k, d) m(d) nocons
  note: standard errors may not be valid
  
  Generalized method of moments estimation
  
  Fitting full model:
  Step 1         f(b) =  .00130087
  
  Group variable: id                           Number of obs         =       891
  Time variable: year                          Number of groups      =       140
  
  Moment conditions:     linear =       6      Obs per group:    min =         6
                      nonlinear =       0                        avg =  6.364286
                          total =       6                        max =         8
  
  ------------------------------------------------------------------------------
             n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
  -------------+----------------------------------------------------------------
             n |
           L1. |   .8602906   .0979689     8.78   0.000     .6682752    1.052306
               |
             w |  -.5922287    .065327    -9.07   0.000    -.7202672   -.4641902
             k |   .2072601   .0434627     4.77   0.000     .1220748    .2924454
  ------------------------------------------------------------------------------
  Instruments corresponding to the linear moment conditions:
   1, model(diff):
     L1.L.n L2.L.n L3.L.n L4.L.n
   2, model(diff):
     D.w D.k

具有前定变量和工具变量约束的 Arellano-Bover 两步 GMM 估计:

xtdpdgmm L(0/1).n w k, gmm(L.n w k, l(0 3) c) m(fod) two vce(r)
Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  .00317868
Step 2         f(b) =  .11805918

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =      13      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =      13                        max =         8

                                    (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
              |              WC-Robust
            n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
            n |
          L1. |   .4582898   .1314203     3.49   0.000     .2007107    .7158688
              |
            w |  -1.607401   .3437998    -4.68   0.000    -2.281237   -.9335663
            k |   .0878702   .1647289     0.53   0.594    -.2349925    .4107329
        _cons |   5.644924   1.001522     5.64   0.000     3.681976    7.607871
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
  1, model(fodev):
    L.n L1.L.n L2.L.n L3.L.n w L1.w L2.w L3.w k L1.k L2.k L3.k
  2, model(level):
    _cons

具有前定变量和工具变量约束的 Ahn-Schmidt 两步 GMM 估计:

xtdpdgmm L(0/1).n w k, gmm(L.n w k, l(1 4) c) m(d) nl(noser) two vce(r)
xtdpdgmm L(0/1).n w k, gmm(L.n w k, l(1 4) c) m(d) nl(iid) two vce(r)
Generalized method of moments estimation

Fitting full model:

Step 1:
initial:       f(b) =  6.9689895
alternative:   f(b) =  1.9358147
rescale:       f(b) =  .09404104
Iteration 0:   f(b) =  .09404104  
Iteration 1:   f(b) =  .00092528  
Iteration 2:   f(b) =  .00073988  
Iteration 3:   f(b) =  .00073977  
Iteration 4:   f(b) =  .00073977  

Step 2:
Iteration 0:   f(b) =   .1213722  
Iteration 1:   f(b) =  .10323966  
Iteration 2:   f(b) =  .10315659  
Iteration 3:   f(b) =    .103154  
Iteration 4:   f(b) =   .1031539  

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =      13      Obs per group:    min =         6
                    nonlinear =       6                        avg =  6.364286
                        total =      19                        max =         8

                                    (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
              |              WC-Robust
            n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
            n |
          L1. |   .4304133   .1198004     3.59   0.000     .1956088    .6652178
              |
            w |   -1.41989   .2825341    -5.03   0.000    -1.973647   -.8661332
            k |   .1917874   .1248583     1.54   0.125    -.0529303    .4365051
        _cons |   5.112359   .8521958     6.00   0.000     3.442086    6.782632
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
  1, model(diff):
    L1.L.n L2.L.n L3.L.n L4.L.n L1.w L2.w L3.w L4.w L1.k L2.k L3.k L4.k
  2, model(level):
    _cons
Generalized method of moments estimation

Fitting full model:

Step 1:
initial:       f(b) =  7.1763841
alternative:   f(b) =  2.0088687
rescale:       f(b) =  .10682203
Iteration 0:   f(b) =  .10682203  
Iteration 1:   f(b) =  .00313745  
Iteration 2:   f(b) =  .00214453  
Iteration 3:   f(b) =  .00213797  
Iteration 4:   f(b) =  .00213795  

Step 2:
Iteration 0:   f(b) =  .22634011  
Iteration 1:   f(b) =  .18572491  
Iteration 2:   f(b) =  .18339137  
Iteration 3:   f(b) =  .18323575  
Iteration 4:   f(b) =  .18322289  
Iteration 5:   f(b) =  .18322171  
Iteration 6:   f(b) =   .1832216  

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =      19      Obs per group:    min =         6
                    nonlinear =       7                        avg =  6.364286
                        total =      26                        max =         8

                                    (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
              |              WC-Robust
            n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
            n |
          L1. |   .3162345   .1040268     3.04   0.002     .1123458    .5201233
              |
            w |  -1.225117   .2050917    -5.97   0.000     -1.62709   -.8231451
            k |   .3370022   .1265224     2.66   0.008     .0890228    .5849816
        _cons |   4.729435   .6060333     7.80   0.000     3.541632    5.917239
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
  1, model(iid):
    1978:L.n 1979:L.n 1980:L.n 1981:L.n 1982:L.n 1983:L.n
  2, model(diff):
    L1.L.n L2.L.n L3.L.n L4.L.n L1.w L2.w L3.w L4.w L1.k L2.k L3.k L4.k
  3, model(level):
    _cons

具有前定变量和工具变量约束的 Blundell-Bond 两步 GMM 估计:

xtdpdgmm L(0/1).n w k, gmm(L.n w k, l(1 4) c m(d)) iv(L.n w k, d) two vce(r)
Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  .00329575
Step 2         f(b) =  .16391388

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =      16      Obs per group:    min =         6
                    nonlinear =       0                        avg =  6.364286
                        total =      16                        max =         8

                                   (Std. Err. adjusted for 140 clusters in id)
------------------------------------------------------------------------------
             |              WC-Robust
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           n |
         L1. |   .4695086   .1167909     4.02   0.000     .2406028    .6984145
             |
           w |  -1.287266   .2672931    -4.82   0.000    -1.811151   -.7633817
           k |   .2172426   .0913599     2.38   0.017     .0381805    .3963046
       _cons |   4.633068   .8721846     5.31   0.000     2.923618    6.342518
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
 1, model(diff):
   L1.L.n L2.L.n L3.L.n L4.L.n L1.w L2.w L3.w L4.w L1.k L2.k L3.k L4.k
 2, model(level):
   D.L.n D.w D.k
 3, model(level):
   _cons

具有前定变量的 Hayakawa-Qi-Breitung IV 估计量:

xtdpdgmm L(0/1).n w k, iv(L.n w k, bod) m(fod) nocons
note: standard errors may not be valid

Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  1.737e-33

Group variable: id                           Number of obs         =       891
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =       3      Obs per group:    min =         6
                  nonlinear =       0                        avg =  6.364286
                      total =       3                        max =         8

------------------------------------------------------------------------------
          n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          n |
        L1. |   .4698431   .1508717     3.11   0.002     .1741401    .7655461
            |
          w |   -.682973   .3756931    -1.82   0.069    -1.419318    .0533719
          k |  -.1261108    .339384    -0.37   0.710    -.7912913    .5390696
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
1, model(fodev):
  B.L.n B.w B.k

复制静态 (加权) 固定效应估计:

xtdpdgmm n w k, iv(w k) m(md)
by id: egen weight = count(e(sample))
replace weight = sqrt(weight/(weight-1))
xtreg n w k [aw=weight], fe
note: standard errors may not be valid

Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  2.557e-25

Group variable: id                           Number of obs         =      1031
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =       3      Obs per group:    min =         7
                    nonlinear =       0                        avg =  7.364286
                        total =       3                        max =         9

------------------------------------------------------------------------------
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           w |  -.3666355   .0522024    -7.02   0.000    -.4689504   -.2643207
           k |   .6407201   .0200955    31.88   0.000     .6013336    .6801065
       _cons |   2.491261   .1627504    15.31   0.000     2.172276    2.810246
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
 1, model(mdev):
   w k
 2, model(level):
   _cons

(1,031 real changes made)

Fixed-effects (within) regression               Number of obs     =      1,031
Group variable: id                              Number of groups  =        140

R-sq:                                           Obs per group:
     within  = 0.5707                                         min =          7
     between = 0.8466                                         avg =        7.4
     overall = 0.8341                                         max =          9

                                                F(2,889)          =     590.79
corr(u_i, Xb)  = 0.4345                         Prob > F          =     0.0000

------------------------------------------------------------------------------
           n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           w |  -.3666355   .0522948    -7.01   0.000    -.4692711   -.2639999
           k |   .6407201   .0201368    31.82   0.000     .6011988    .6802413
       _cons |   2.492481    .163067    15.29   0.000      2.17244    2.812523
-------------+----------------------------------------------------------------
     sigma_u |  .58858668
     sigma_e |  .13719403
         rho |  .94846853   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(139, 889) = 110.65                  Prob > F = 0.0000

复制静态 (未加权) 固定效应估计:

xtdpdgmm n w k, iv(w k) m(md) nores
xtreg n w k, fe
note: standard errors may not be valid

Generalized method of moments estimation

Fitting full model:
Step 1         f(b) =  4.270e-25

Group variable: id                           Number of obs         =      1031
Time variable: year                          Number of groups      =       140

Moment conditions:     linear =       3      Obs per group:    min =         7
                    nonlinear =       0                        avg =  7.364286
                        total =       3                        max =         9

------------------------------------------------------------------------------
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           w |   -.367774   .0522015    -7.05   0.000     -.470087   -.2654611
           k |   .6403675    .020095    31.87   0.000     .6009819     .679753
       _cons |   2.494684   .1627475    15.33   0.000     2.175704    2.813663
------------------------------------------------------------------------------
Instruments corresponding to the linear moment conditions:
 1, model(mdev):
   w k
 2, model(level):
   _cons
Fixed-effects (within) regression               Number of obs     =      1,031
Group variable: id                              Number of groups  =        140

R-sq:                                           Obs per group:
     within  = 0.5704                                         min =          7
     between = 0.8466                                         avg =        7.4
     overall = 0.8341                                         max =          9

                                                F(2,889)          =     590.13
corr(u_i, Xb)  = 0.4352                         Prob > F          =     0.0000

------------------------------------------------------------------------------
           n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           w |   -.367774   .0523227    -7.03   0.000    -.4704645   -.2650835
           k |   .6403675   .0201417    31.79   0.000     .6008366    .6798984
       _cons |   2.494684   .1631256    15.29   0.000     2.174527     2.81484
-------------+----------------------------------------------------------------
     sigma_u |  .58883268
     sigma_e |   .1372825
         rho |  .94844636   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(139, 889) = 110.72                  Prob > F = 0.0000

4. 参考文献

  • Ahn, S. C., and P. Schmidt. 1995. Efficient estimation of models for dynamic panel data. Journal of Econometrics 68: 5-27. -Link-
  • Anderson, T. W., and C. Hsiao. 1981. Estimation of dynamic models with error components. Journal of the American Statistical Association 76: 598-606. -Link-
  • Arellano, M., and S. R. Bond. 1991. Some tests of specification for panel data: Monte Carlo evidence and an application to employment equations. Review of Economic Studies 58: 277-297. -Link-
  • Arellano, M., and O. Bover. 1995. Another look at the instrumental variable estimation of error-components models. Journal of Econometrics 68: 29-51. -Link-
  • Blundell, R., and S. R. Bond. 1998. Initial conditions and moment restrictions in dynamic panel data models. Journal of Econometrics 87: 115-143. -Link-
  • Hansen, L. P., J. Heaton, and A. Yaron. 1996. Finite-sample properties of some alternative GMM estimators. Journal of Business & Economic Statistics 14: 262-280. -Link-
  • Hayakawa, K., M. Qi, and J. Breitung. 2019. Double filter instrumental variable estimation of panel data models with weakly exogenous variables. Econometric Reviews 38: 1055-1088. -Link-
  • Kiviet, J. F. 2020. Microeconometric dynamic panel data methods: Model specification and selection issues. Econometrics and Statistics 13: 16-45. -Link-
  • Kripfganz, S., and C. Schwarz. 2019. Estimation of linear dynamic panel data models with time-invariant regressors. Journal of Applied Econometrics 34: 526-546. -Link-
  • Roodman, D. 2009. A note on the theme of too many instruments. Oxford Bulletin of Economics and Statistics 71: 135-158. -Link-
  • Windmeijer, F. 2005. A finite sample correction for the variance of linear efficient two-step GMM estimators. Journal of Econometrics 126: 25-51. -Link-

5. 相关推文

Note: 产生如下推文列表的命令为:
lianxh 动态面板 过度识别 GMM IV, m
安装最新版 lianxh 命令:
ssc install lianxh, replace

相关课程

连享会-直播课 上线了!
http://lianxh.duanshu.com

免费公开课:


课程一览

支持回看

专题 嘉宾 直播/回看视频
最新专题 因果推断, 空间计量,寒暑假班等
数据清洗系列 游万海 直播, 88 元,已上线
研究设计 连玉君 我的特斯拉-实证研究设计-幻灯片-
面板模型 连玉君 动态面板模型-幻灯片-
面板模型 连玉君 直击面板数据模型 [免费公开课,2小时]

Note: 部分课程的资料,PPT 等可以前往 连享会-直播课 主页查看,下载。


关于我们

  • Stata连享会 由中山大学连玉君老师团队创办,定期分享实证分析经验。直播间 有很多视频课程,可以随时观看。
  • 连享会-主页知乎专栏,300+ 推文,实证分析不再抓狂。
  • 公众号关键词搜索/回复 功能已经上线。大家可以在公众号左下角点击键盘图标,输入简要关键词,以便快速呈现历史推文,获取工具软件和数据下载。常见关键词:课程, 直播, 视频, 客服, 模型设定, 研究设计, stata, plus, 绘图, 编程, 面板, 论文重现, 可视化, RDD, DID, PSM, 合成控制法

连享会主页  lianxh.cn
连享会主页 lianxh.cn

连享会小程序:扫一扫,看推文,看视频……

扫码加入连享会微信群,提问交流更方便

✏ 连享会学习群-常见问题解答汇总:
https://gitee.com/arlionn/WD

New! lianxh 命令发布了:
随时搜索连享会推文、Stata 资源,安装命令如下:
. ssc install lianxh
使用详情参见帮助文件 (有惊喜):
. help lianxh