Statalist


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

st: RE: xtdpd vs. xtabond2 discrepancy


From   <[email protected]>
To   "David M. Drukker" <[email protected]>, [email protected]
Subject   st: RE: xtdpd vs. xtabond2 discrepancy
Date   Wed, 13 Jan 2010 23:05:10 -0600 (CST)

I am having some issues replicating some -xtdpd- results with
-gmm-.  First, -gmm- generates a puzzling error when I specify
analytic derivatives and use instruments with a higher lag
limit.  Second, even when I don't specify the analytic
derivatives, -gmm- generates different results from -xtdpd-.

Here I repeat David Drukker's example with one change: I
increase the lag limit for both the level and differenced
equation by 1.  Stata reports a conformability error and I
don't understand why:

. webuse abdata, clear

. 
. gmm (n - {rho}*L.n - {c}) (D.n - {rho}*LD.n  ),
xtinstruments(1: D.n, lags(2/2)) xtinstruments(2:n, lags(3/.))
instrume
> nts(2:, noconstant) deriv(1/rho = -1*L.n) deriv(1/c=-1)
deriv(2/rho = -1*LD.n) winitial(xt LD) onestep vce(unadjusted) 
> variables(L.n ) nocommonesample

Step 1
                       *:  3200  conformability error
             gmm_deriv():     -  function returned error
         criterion_gnr():     -  function returned error
      opt__calluser1_q():     -  function returned error
       opt__eval_gn_q1():     -  function returned error
             opt__eval():     -  function returned error
opt__looputil_iter0_gn():     -  function returned error
          opt__loop_gn():     -  function returned error
              optimize():     -  function returned error
                 mymin():     -  function returned error
              _gmm_wrk():     -  function returned error
                 <istmt>:     -  function returned error
r(3200);


If I don't specify the analytic derivatives then -gmm- will
produce an estimate (see output below).  I can't seem to
replicate its results when I use what I think would be the
equivalent -xtdpd- command, however:

. gmm (n - {rho}*L.n - {c}) (D.n - {rho}*LD.n  ),
xtinstruments(1: D.n, lags(2/2)) xtinstruments(2:n,
lags(3/.))	instrume
> nts(2:, noconstant) winitial(xt LD) onestep vce(unadjusted)
variables(L.n ) nocommonesample

Step 1
Iteration 0:   GMM criterion Q(b) =  .08204623  
Iteration 1:   GMM criterion Q(b) =  .00013918  
Iteration 2:   GMM criterion Q(b) =  .00013918  

GMM estimation 

Number of parameters =   2
Number of moments    =  29
Initial weight matrix: XT LD                          Number
of obs  =   *


Coef.   Std. Err.      z    P>z     [95% Conf. Interval]

/rho    1.073292   .0239215    44.87   0.000     1.026407   
1.120177
/c   -.1340523   .0259783    -5.16   0.000    -.1849688  
-.0831359

* Number of observations for equation 1: 891
Number of observations for equation 2: 751

Instruments for equation 1:
XT-style: L2D.n
Standard: _cons
Instruments for equation 2:
XT-style: L(3/.).n

. 
. xtdpd n L.n, dgmm(n, lagrange(3 .)) lgmm(n, lag(2))

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 =     28               Wald chi2(1)    
     =   2059.36
Prob > chi2           =    0.0000
One-step results

n       Coef.   Std. Err.      z    P>z     [95% Conf. Interval]

n 
L1.    1.080427   .0238084    45.38   0.000     1.033764   
1.127091
             
_cons   -.1309317   .0261323    -5.01   0.000    -.1821502  
-.0797133

Instruments for differenced equation
GMM-type: L(3/.).n
Instruments for level equation
GMM-type: L2D.n
Standard: _cons

-- Julian

---- Original message ----
>Date: Wed, 13 Jan 2010 18:29:11 -0600 (CST)
>From: "David M. Drukker" <[email protected]>  
>Subject: Re: st: RE: xtdpd vs. xtabond2 discrepancy  
>To: [email protected]
>Cc: [email protected], David Roodman <[email protected]>
>
>There has been some discussion about a difference in the
standard errors 
>reported by -xtdpd- and -xtabond2-.
>
>The discussion began with question about how to get the point
estimates to 
>match.
>
>Julian <[email protected]> noted that
>
>> You need to add an h(2) option to -xtabond2-.  The following
>> will produce the same point estimates:
>>
>> webuse abdata, clear
>> xtabond2 n L.n, gmm(n, laglimits(2 .)) small h(2)
>> xtdpd n L.n, dgmm(n, lagrange(2 .)) lgmm(n, lag(1))
>
>Julian continued that 
>> The standard errors are still different though.
>
>David Roodman <[email protected]>  noted that
>
>> I think the remaining discrepency between xtdpd in xtabond2
in the
>> standard errors only occurs if you do one-step, non-robust
estimation,
>> which is rare.
>
>David went to verify that -xtabond2- is able replicate a
version of DPD in
>OX that has a known bug, but I do not understand how this
resolves anything.
>
>I cannot speak to what -xtabond2- does, so I will not say
anything about it.
>
>Below I illustrate that -xtdpd- produces the same point
estimates and
>standard errors as produced by the -gmm- command in Stata.  I
conclude that
>the point estimates and standard errors produced by -xtdpd-
are correct,
>because I can reproduce them using another Stata command that
is independent
>of -xtdpd-.
>
>I begin by loading the data and estimating the paramters
using -xtdpd-.
>
>.  webuse abdata, clear
>
>. 
>. xtdpd n L.n, dgmm(n, lagrange(2 .)) lgmm(n, lag(1))
>
>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 =     36               Wald chi2(1)   
      =   1724.98
>                                              Prob > chi2   
       =    0.0000
>One-step results
>------------------------------------------------------------------------------
>            n |      Coef.   Std. Err.      z    P>|z|    
[95% Conf. Interval]
>-------------+----------------------------------------------------------------
>            n |
>          L1. |   1.170374   .0281795    41.53   0.000    
1.115144    1.225605
>              |
>        _cons |   -.228391   .0308445    -7.40   0.000   
-.2888452   -.1679369
>------------------------------------------------------------------------------
>Instruments for differenced equation
>         GMM-type: L(2/.).n
>Instruments for level equation
>         GMM-type: LD.n
>         Standard: _cons
>
>Now I estimate the parameters using the -gmm- command.
>
>.  gmm (n - {rho}*L.n - {c})                              ///
>>             (D.n - {rho}*LD.n  ),                       ///
>>             xtinstruments(1:D.n, lags(1/1))               
             ///
>>             xtinstruments(2:n, lags(2/.))                 
             ///
>>             instruments(2: , noconstant)                  
             ///
>>             deriv(1/rho = -1*L.n)                         
             ///
>>             deriv(1/c = -1)                               
             ///
>>             deriv(2/rho = -1*LD.n)                        
             ///
>>             winitial(xt LD) onestep vce(unadjusted)       
             ///
>>             variables(L.n )                               
     ///
>>             nocommonesample
>
>Step 1
>Iteration 0:   GMM criterion Q(b) =  .10163841 
>Iteration 1:   GMM criterion Q(b) =  .00035315 
>Iteration 2:   GMM criterion Q(b) =  .00035315
>
>GMM estimation
>
>Number of parameters =   2
>Number of moments    =  37
>Initial weight matrix: XT LD                          Number
of obs  =   *
>
>------------------------------------------------------------------------------
>              |      Coef.   Std. Err.      z    P>|z|    
[95% Conf. Interval]
>-------------+----------------------------------------------------------------
>         /rho |   1.170374   .0281795    41.53   0.000    
1.115144    1.225605
>           /c |   -.228391   .0308445    -7.40   0.000   
-.2888452   -.1679369
>------------------------------------------------------------------------------
>* Number of observations for equation 1: 891
>   Number of observations for equation 2: 751
>------------------------------------------------------------------------------
>Instruments for equation 1:
>         XT-style: LD.n
>         Standard: _cons
>Instruments for equation 2:
>         XT-style: L(2/.).n
>
>The two commands produce the same point estimates and the
same standard 
>errors.
>
>The syntax for -gmm- is a little involved.  This example is a
stripped down
>version of the example on page 612 of the Stata Reference
manual [R] A-H.  I
>recommend looking there for details about how the -gmm-
syntax works.
>
>I conclude that the point estimates and the standard errors
produced by
>-xtdpd- are correct.
>
>    --David
>      [email protected]
>
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index