Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# [no subject]

```Dear Stata users,

I believe stata's xtdpd and Roodman's xtabond2 produce different
results when estimating a just-identified model.

Below I present a set of estimations of the same model using
alternatively xtabond2 and xtdpd and abdata.dta . All estimation
generate the same coefficient estimates, except for the
just-identified model (the last three tables below). I can't figure
out what's going on. Do you have suggestion?

. xtdpd n w k yr*, dgmmiv(w k, l(2 10)) div( yr*) vce(robust) twostep nocons
note: yr1976 dropped from div() because of collinearity
note: D.yr1976 dropped because of collinearity

Dynamic panel-data estimation                Number of obs         =       891
Group variable: id                           Number of groups      =       140
Time variable: year
Obs per group:    min =         6
avg =  6.364286
max =         8

Number of instruments =     64               Wald chi2(10)         =    263.63
Prob > chi2           =    0.0000
Two-step results
------------------------------------------------------------------------------
|              WC-Robust
n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w |  -.5251849   .1867368    -2.81   0.005    -.8911822   -.1591875
k |   .6931066   .1156379     5.99   0.000     .4664605    .9197527
yr1977 |  -.0468811   .0224064    -2.09   0.036    -.0907969   -.0029653
yr1978 |   -.079391   .0260936    -3.04   0.002    -.1305336   -.0282485
yr1979 |  -.0908402   .0294539    -3.08   0.002    -.1485689   -.0331115
yr1980 |  -.1082455    .028502    -3.80   0.000    -.1641083   -.0523827
yr1981 |  -.1367655   .0256726    -5.33   0.000    -.1870828   -.0864482
yr1982 |  -.1329874   .0307649    -4.32   0.000    -.1932854   -.0726893
yr1983 |  -.1100415   .0381101    -2.89   0.004     -.184736    -.035347
yr1984 |  -.0741515   .0441612    -1.68   0.093    -.1607057    .0124028
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/10).w L(2/10).k
Standard: D.yr1977 D.yr1978 D.yr1979 D.yr1980 D.yr1981
D.yr1982 D.yr1983 D.yr1984

. drop _est_dpd _est_ab2

. estimates store dpd

. xtabond2 n w k yr*, gmm(w k, l(2 10)) iv(yr*) robust twostep nolevel
Favoring speed over space. To switch, type or click on mata: mata set
matafavor space, perm.
yr1984 dropped due to collinearity
Warning: Two-step estimated covariance matrix of moments is singular.
Using a generalized inverse to calculate optimal weighting matrix
for two-step estimation.
Difference-in-Sargan/Hansen statistics may be negative.

Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id                              Number of obs      =       891
Time variable : year                            Number of groups   =       140
Number of instruments = 64                      Obs per group: min =         6
Wald chi2(10) =    263.63                                      avg =      6.36
Prob > chi2   =     0.000                                      max =         8
------------------------------------------------------------------------------
|              Corrected
n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w |  -.5251849   .1867368    -2.81   0.005    -.8911822   -.1591875
k |   .6931066   .1156379     5.99   0.000     .4664605    .9197527
yr1976 |   .0741515   .0441612     1.68   0.093    -.0124028    .1607057
yr1977 |   .0272704    .046981     0.58   0.562    -.0648106    .1193514
yr1978 |  -.0052396   .0514405    -0.10   0.919    -.1060611     .095582
yr1979 |  -.0166887   .0541152    -0.31   0.758    -.1227526    .0893751
yr1980 |   -.034094   .0519545    -0.66   0.512     -.135923     .067735
yr1981 |  -.0626141     .03934    -1.59   0.111    -.1397191     .014491
yr1982 |  -.0588359   .0246208    -2.39   0.017    -.1070917   -.0105801
yr1983 |    -.03589   .0152096    -2.36   0.018    -.0657003   -.0060797
------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(yr1976 yr1977 yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(2/10).(w k)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =  -0.40  Pr > z =  0.689
Arellano-Bond test for AR(2) in first differences: z =  -1.70  Pr > z =  0.088
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(54)   = 100.69  Prob > chi2 =  0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(54)   =  61.06  Prob > chi2 =  0.237
(Robust, but can be weakened by many instruments.)

Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(yr1976 yr1977 yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984)
Hansen test excluding group:     chi2(46)   =  51.97  Prob > chi2 =  0.253
Difference (null H = exogenous): chi2(8)    =   9.09  Prob > chi2 =  0.335

. estimates store ab2

. esttab dpd ab2

--------------------------------------------
(1)             (2)
n               n
--------------------------------------------
w                  -0.525**        -0.525**
(-2.81)         (-2.81)

k                   0.693***        0.693***
(5.99)          (5.99)

yr1977            -0.0469*         0.0273
(-2.09)          (0.58)

yr1978            -0.0794**      -0.00524
(-3.04)         (-0.10)

yr1979            -0.0908**       -0.0167
(-3.08)         (-0.31)

yr1980             -0.108***      -0.0341
(-3.80)         (-0.66)

yr1981             -0.137***      -0.0626
(-5.33)         (-1.59)

yr1982             -0.133***      -0.0588*
(-4.32)         (-2.39)

yr1983             -0.110**       -0.0359*
(-2.89)         (-2.36)

yr1984            -0.0742
(-1.68)

yr1976                             0.0742
(1.68)
--------------------------------------------
N                     891             891
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. drop  _est_dpd _est_ab2

. xtdpd n w k yr*, dgmmiv(w k, l(2 3)) div( yr*) vce(robust) twostep nocons
note: yr1976 dropped from div() because of collinearity
note: D.yr1976 dropped because of collinearity

Dynamic panel-data estimation                Number of obs         =       891
Group variable: id                           Number of groups      =       140
Time variable: year
Obs per group:    min =         6
avg =  6.364286
max =         8

Number of instruments =     34               Wald chi2(10)         =    345.89
Prob > chi2           =    0.0000
Two-step results
------------------------------------------------------------------------------
|              WC-Robust
n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w |  -.3776668   .2218938    -1.70   0.089    -.8125707    .0572371
k |   .5092317   .1684431     3.02   0.003     .1790893    .8393742
yr1977 |  -.0312372   .0242268    -1.29   0.197     -.078721    .0162465
yr1978 |  -.0533206   .0304038    -1.75   0.079    -.1129109    .0062697
yr1979 |  -.0617977   .0331106    -1.87   0.062    -.1266932    .0030978
yr1980 |  -.0896192    .032657    -2.74   0.006    -.1536258   -.0256127
yr1981 |  -.1448843   .0292449    -4.95   0.000    -.2022033   -.0875652
yr1982 |  -.1697914   .0378177    -4.49   0.000    -.2439128   -.0956701
yr1983 |  -.1665457   .0492459    -3.38   0.001    -.2630659   -.0700256
yr1984 |  -.1511347   .0648747    -2.33   0.020    -.2782867   -.0239827
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/3).w L(2/3).k
Standard: D.yr1977 D.yr1978 D.yr1979 D.yr1980 D.yr1981
D.yr1982 D.yr1983 D.yr1984

. estimates store dpd

. xtabond2 n w k yr*, gmm(w k, l(2 3)) iv(yr*) robust twostep nolevel
Favoring speed over space. To switch, type or click on mata: mata set
matafavor space, perm.
yr1984 dropped due to collinearity
Warning: Two-step estimated covariance matrix of moments is singular.
Using a generalized inverse to calculate optimal weighting matrix
for two-step estimation.
Difference-in-Sargan/Hansen statistics may be negative.

Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id                              Number of obs      =       891
Time variable : year                            Number of groups   =       140
Number of instruments = 34                      Obs per group: min =         6
Wald chi2(10) =    345.89                                      avg =      6.36
Prob > chi2   =     0.000                                      max =         8
------------------------------------------------------------------------------
|              Corrected
n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w |  -.3776668   .2218938    -1.70   0.089    -.8125707    .0572371
k |   .5092317   .1684431     3.02   0.003     .1790893    .8393742
yr1976 |   .1511347   .0648747     2.33   0.020     .0239827    .2782867
yr1977 |   .1198974   .0689463     1.74   0.082    -.0152348    .2550297
yr1978 |   .0978141   .0758716     1.29   0.197    -.0508914    .2465197
yr1979 |    .089337   .0789305     1.13   0.258     -.065364     .244038
yr1980 |   .0615155   .0736248     0.84   0.403    -.0827866    .2058175
yr1981 |   .0062504   .0554414     0.11   0.910    -.1024127    .1149135
yr1982 |  -.0186567   .0355157    -0.53   0.599    -.0882662    .0509527
yr1983 |   -.015411   .0205404    -0.75   0.453    -.0556695    .0248474
------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(yr1976 yr1977 yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(2/3).(w k)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =   0.44  Pr > z =  0.660
Arellano-Bond test for AR(2) in first differences: z =  -0.86  Pr > z =  0.390
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(24)   =  43.27  Prob > chi2 =  0.009
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(24)   =  25.01  Prob > chi2 =  0.405
(Robust, but can be weakened by many instruments.)

Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(yr1976 yr1977 yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984)
Hansen test excluding group:     chi2(16)   =  16.30  Prob > chi2 =  0.432
Difference (null H = exogenous): chi2(8)    =   8.71  Prob > chi2 =  0.367

. estimates store ab2

. esttab dpd ab2

--------------------------------------------
(1)             (2)
n               n
--------------------------------------------
w                  -0.378          -0.378
(-1.70)         (-1.70)

k                   0.509**         0.509**
(3.02)          (3.02)

yr1977            -0.0312           0.120
(-1.29)          (1.74)

yr1978            -0.0533          0.0978
(-1.75)          (1.29)

yr1979            -0.0618          0.0893
(-1.87)          (1.13)

yr1980            -0.0896**        0.0615
(-2.74)          (0.84)

yr1981             -0.145***      0.00625
(-4.95)          (0.11)

yr1982             -0.170***      -0.0187
(-4.49)         (-0.53)

yr1983             -0.167***      -0.0154
(-3.38)         (-0.75)

yr1984             -0.151*
(-2.33)

yr1976                              0.151*
(2.33)
--------------------------------------------
N                     891             891
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. xtdpd n w k yr*, dgmmiv(w k, l(2 2)) div( yr*) vce(robust) twostep nocons
note: yr1976 dropped from div() because of collinearity
note: D.yr1976 dropped because of collinearity

Dynamic panel-data estimation                Number of obs         =       891
Group variable: id                           Number of groups      =       140
Time variable: year
Obs per group:    min =         6
avg =  6.364286
max =         8

Number of instruments =     22               Wald chi2(10)         =    282.19
Prob > chi2           =    0.0000
Two-step results
------------------------------------------------------------------------------
|              WC-Robust
n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w |  -.5975386     .22683    -2.63   0.008    -1.042117     -.15296
k |   .8595294   .2587153     3.32   0.001     .3524567    1.366602
yr1977 |  -.0548315   .0248217    -2.21   0.027    -.1034811   -.0061819
yr1978 |  -.0999575   .0341455    -2.93   0.003    -.1668814   -.0330336
yr1979 |  -.1194597   .0385212    -3.10   0.002      -.19496   -.0439595
yr1980 |    -.12629   .0349355    -3.61   0.000    -.1947623   -.0578176
yr1981 |  -.1332924   .0315413    -4.23   0.000    -.1951123   -.0714726
yr1982 |  -.1101542   .0543083    -2.03   0.043    -.2165964   -.0037119
yr1983 |   -.073628   .0737858    -1.00   0.318    -.2182454    .0709895
yr1984 |   -.038052   .0967039    -0.39   0.694    -.2275881    .1514842
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/2).w L(2/2).k
Standard: D.yr1977 D.yr1978 D.yr1979 D.yr1980 D.yr1981
D.yr1982 D.yr1983 D.yr1984

. estimates store dpd

. xtabond2 n w k yr*, gmm(w k, l(2 2)) iv(yr*) robust twostep nolevel
Favoring speed over space. To switch, type or click on mata: mata set
matafavor space, perm.
yr1984 dropped due to collinearity
Warning: Two-step estimated covariance matrix of moments is singular.
Using a generalized inverse to calculate optimal weighting matrix
for two-step estimation.
Difference-in-Sargan/Hansen statistics may be negative.

Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id                              Number of obs      =       891
Time variable : year                            Number of groups   =       140
Number of instruments = 22                      Obs per group: min =         6
Wald chi2(10) =    265.24                                      avg =      6.36
Prob > chi2   =     0.000                                      max =         8
------------------------------------------------------------------------------
|              Corrected
n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w |  -.5482155   .1914433    -2.86   0.004    -.9234375   -.1729936
k |   .7211971   .3095853     2.33   0.020     .1144209    1.327973
yr1976 |   .0840834   .1057541     0.80   0.427    -.1231909    .2913577
yr1977 |   .0351314   .1117762     0.31   0.753    -.1839458    .2542087
yr1978 |  -.0016077   .1249189    -0.01   0.990    -.2464443    .2432289
yr1979 |   -.017301   .1322428    -0.13   0.896    -.2764921    .2418901
yr1980 |  -.0296638   .1200275    -0.25   0.805    -.2649135    .2055858
yr1981 |   -.051615     .08634    -0.60   0.550    -.2208382    .1176082
yr1982 |  -.0477458   .0482995    -0.99   0.323     -.142411    .0469194
yr1983 |   -.025815   .0244998    -1.05   0.292    -.0738337    .0222037
------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(yr1976 yr1977 yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L2.(w k)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =  -0.48  Pr > z =  0.631
Arellano-Bond test for AR(2) in first differences: z =  -1.36  Pr > z =  0.173
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(12)   =  28.17  Prob > chi2 =  0.005
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(12)   =  14.79  Prob > chi2 =  0.253
(Robust, but can be weakened by many instruments.)

Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(yr1976 yr1977 yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984)
Hansen test excluding group:     chi2(4)    =   5.46  Prob > chi2 =  0.243
Difference (null H = exogenous): chi2(8)    =   9.33  Prob > chi2 =  0.315

. estimates store ab2

. esttab dpd ab2

--------------------------------------------
(1)             (2)
n               n
--------------------------------------------
w                  -0.598**        -0.548**
(-2.63)         (-2.86)

k                   0.860***        0.721*
(3.32)          (2.33)

yr1977            -0.0548*         0.0351
(-2.21)          (0.31)

yr1978            -0.1000**      -0.00161
(-2.93)         (-0.01)

yr1979             -0.119**       -0.0173
(-3.10)         (-0.13)

yr1980             -0.126***      -0.0297
(-3.61)         (-0.25)

yr1981             -0.133***      -0.0516
(-4.23)         (-0.60)

yr1982             -0.110*        -0.0477
(-2.03)         (-0.99)

yr1983            -0.0736         -0.0258
(-1.00)         (-1.05)

yr1984            -0.0381
(-0.39)

yr1976                             0.0841
(0.80)
--------------------------------------------
N                     891             891
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001