Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: discrepancy xtdpd vs xtabond2


From   "David Roodman (droodman@cgdev.org)" <DRoodman@cgdev.org>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: discrepancy xtdpd vs xtabond2
Date   Sat, 18 Sep 2010 17:37:32 +0000

I'm not sure what is causing the discrepancy. I stripped down Daniel's example to something simpler that still generates a discrepancy, and then ran the equivalent in DPD for Ox (Doornik, Arrelano, and Bond 2001). DPD agrees with xtabond2. However, the last time something like that happened (http://www.stata.com/statalist/archive/2010-01/msg00432.html), it turned out that the problem was DPD *and* xtabond2. (I used DPD as my benchmark in writing xtabond2.) Below are the runs from xtdpd, xtabond2, and DPD:

. webuse abadata
. xtdpd n w, dgmmiv(w k, l(2 2)) nocons

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 =     14               Wald chi2(1)          =    323.67
                                             Prob > chi2           =    0.0000
One-step results
------------------------------------------------------------------------------
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           w |   -2.77159    .154056   -17.99   0.000    -3.073534   -2.469646
------------------------------------------------------------------------------
Instruments for differenced equation
        GMM-type: L(2/2).w L(2/2).k

. xtabond2 n w, gmm(w k, l(2 2)) nolevel
Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.

Dynamic panel-data estimation, one-step difference GMM
------------------------------------------------------------------------------
Group variable: id                              Number of obs      =       891
Time variable : year                            Number of groups   =       140
Number of instruments = 14                      Obs per group: min =         6
Wald chi2(1)  =    312.84                                      avg =      6.36
Prob > chi2   =     0.000                                      max =         8
------------------------------------------------------------------------------
           n |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           w |  -2.878515    .162745   -17.69   0.000    -3.197489   -2.559541
------------------------------------------------------------------------------
Instruments for first differences equation
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    L2.(w k)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =  -1.32  Pr > z =  0.186
Arellano-Bond test for AR(2) in first differences: z =   0.64  Pr > z =  0.524
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(13)   =  46.13  Prob > chi2 =  0.000
  (Not robust, but not weakened by many instruments.)



DPD code:
#include <oxstd.h>
#import <packages/dpd/dpd>

main()
{
    decl dpd = new DPD(), time = timer(), x;

    dpd.Load("abdata.in7");                    // load data

        dpd.SetYear("YEAR");      // specify columns with years
        dpd.SetGroup("IND");

        dpd.Select(Y_VAR, {"n", 0, 0});      // formulate model
        dpd.Select(X_VAR, {"w", 0, 0});      // formulate model
    dpd.SetDummies(D_NONE); // specify dummies
        dpd.SetOptions(FALSE, -1, -1, -1); // request classical standard errors
    dpd.Gmm("w", 2, 2);            // GMM-type instruments
    dpd.Gmm("k", 2, 2);            // GMM-type instruments

    dpd.SetTest(1, 2); // specification,Sargan,AR 1-2 tests

        dpd.SetMethod(M_1STEP);
        dpd.Estimate();

    delete dpd;                     // finished with object
}

DPD results:
DPD package version 1.24, object created on 18-09-2010

DPD( 1) Modelling n by 1-step (using abdata.in7)

                  ----   1-step estimation using DPD ----
                  Coefficient  Std.Error  t-value  t-prob
Dw                   -2.87851     0.1628    -17.7   0.000

sigma               0.2478555  sigma^2            0.06143233
sigma levels        0.1752603
RSS              54.674777013  TSS              16.886812344
no. of observations       891  no. of parameters           1
Warning: standard errors not robust to heteroscedasticity

Transformation used:      first differences
Level instruments:        Gmm("w",2,2)  Gmm("k",2,2)

constant:                  no  time dummies:               0
number of individuals     140 (derived from year)
longest time series         8 [1977 - 1984]
shortest time series        6 (unbalanced panel)

Wald (joint):    Chi^2(1) =     312.5 [0.000] **
Sargan test:    Chi^2(13) =     46.08 [0.000] **
AR(1) test:        N(0,1) =    -1.323 [0.186]
AR(2) test:        N(0,1) =    0.6374 [0.524]


-------------------------------------------------



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index