Bookmark and Share

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


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

st: David Droodman's new contribution for a system of equations: xtabond2


From   "Abdalla, Ahmed" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: David Droodman's new contribution for a system of equations: xtabond2
Date   Mon, 3 Feb 2014 22:25:17 +0000

Dear Statalist
David Roodman, the author of xtabond2, kindly contributed by a code to calculate Arellano Bond estimators for a two equation system after we exchanged some emails.
I am not sure why the code didn't work when I tried to run it. It seems that I miss something. Also not sure if the problem David mentioned below would be easily treated if I have multiple equations (2 or 4 equations in the system).

David permitted me to post his code on Statalist, so the floor is open to all if anyone can contribute to David's code.

Any advice ?


________________________________________
From: Abdalla, Ahmed
Sent: 01 February 2014 18:03
To: David Roodman
Subject: RE: issues with David Droodman's xtabond2

Dear David
I really appreciate that, and it will be acknowledged !
I tried to run the code you sent but unfortunately it didn't work (error messages). I can't find where the problem comes from to debug the code. Also, does this code allow me to test across equations restrictions post estimation ?
Also, would it be easier if I have multiple equations (i.e. 2 or 4 equations  in the system) rather than 3 ?


Best regards
Ahmed
_______________________________________
From: David Roodman <[email protected]>
Sent: 01 February 2014 14:55
To: Abdalla, Ahmed
Subject: RE: issues with David Droodman's xtabond2

Hi Ahmed,
You're right, it is complicated to do. It seems that you can't use gmm's
"xt" options because those require that there be at most one difference
equation and one levels equation. So you have to generate the instruments
manually (an example of that is in my xtabond2 paper, where it uses
ivregress). And the standard initial weighting matrix, specified by h(2) or
h(3) in xtabond2 and winitial(xt D) in gmm, is not available--gmm complains
that there are no "xt" instruments. So my solution is to start with the
weighting matrix = identity matrix (h(1) in xtabond2 and winitial(identity)
in gmm) which is generally not considered ideal, and then use iterated GMM
(igmm option) to converge to a better weighting matrix, instead of taking
two steps (twostep option). This seems to keep the estimates stable
regardless of initial weighting matrix.

Below is an example of two-equation Arellano-Bond. Blundell-Bond (system
GMM) would be even more complicated. Note that the deriv() options are not
necessary: they are only there for speed.

Feel free to post this on statalist. I hope this helps.
Best,
--David

webuse abdata
global xtinstruments
sum `:char _dta[tis]'
qui forvalues t=`r(min)'/`r(max)' {
        foreach var in n k {
                forvalues lag=2/3 {
                        cap drop `var'`t'L`lag'
                        gen double `var'`t'L`lag' = L`lag'.`var' if `:char
_dta[tis]' == `t'
                        global xtinstruments $xtinstruments `var'`t'L`lag'
                }
        }
}
qui recode $xtinstruments (. = 0)

xtabond2 k L.n L.k w L.w, iv(w L.w) gmm(n k, lag(2 3)) nolev two robust
xtabond2 n L.n L.k w L.w, iv(w L.w) gmm(n k, lag(2 3)) nolev two robust

// exact matches using gmm
#delimit ;
gmm (D.k - {b_kn} *LD.n - {rho_k}*LD.k - {b_kw}*D.w - {b_kLw}*LD.w),
                instruments(1:D.w LD.w, nocons)
                xtinstruments(n k, lags(2/3))
                winitial(xt D)
                wmatrix(cluster `:char _dta[iis]')
                vce    (cluster `:char _dta[iis]')
                variables(D.k LD.n LD.k D.w LD.w)
                deriv(1/rho_k = -1*LD.k)
                deriv(1/b_kn = -1*LD.n)
                deriv(1/b_kw = -1*D.w)
                deriv(1/b_kLw = -1*LD.w)
                twostep;

gmm (D.n - {rho_n} *LD.n - {b_nk}*LD.k - {b_nw}*D.w - {b_nLw}*LD.w),
                instruments(1:D.w LD.w, nocons)
                xtinstruments(n k, lags(2/3))
                winitial(xt D)
                wmatrix(cluster `:char _dta[iis]')
                vce    (cluster `:char _dta[iis]')
                variables(D.k LD.n LD.k D.w LD.w)
                deriv(1/rho_n = -1*LD.n)
                deriv(1/b_nk = -1*LD.k)
                deriv(1/b_nw = -1*D.w)
                deriv(1/b_nLw = -1*LD.w)
                twostep;

// now switch to igmm--changes coefs a little
gmm (D.k - {b_kn} *LD.n - {rho_k}*LD.k - {b_kw}*D.w - {b_kLw}*LD.w),
                instruments(1:D.w LD.w, nocons)
                xtinstruments(n k, lags(2/3))
                winitial(xt D)
                wmatrix(cluster `:char _dta[iis]')
                vce    (cluster `:char _dta[iis]')
                variables(D.k LD.n LD.k D.w LD.w)
                deriv(1/rho_k = -1*LD.k)
                deriv(1/b_kn = -1*LD.n)
                deriv(1/b_kw = -1*D.w)
                deriv(1/b_kLw = -1*LD.w)
                igmm;

gmm (D.n - {rho_n} *LD.n - {b_nk}*LD.k - {b_nw}*D.w - {b_nLw}*LD.w),
                instruments(1:D.w LD.w, nocons)
                xtinstruments(n k, lags(2/3))
                winitial(xt D)
                wmatrix(cluster `:char _dta[iis]')
                vce    (cluster `:char _dta[iis]')
                variables(D.k LD.n LD.k D.w LD.w)
                deriv(1/rho_n = -1*LD.n)
                deriv(1/b_nk = -1*LD.k)
                deriv(1/b_nw = -1*D.w)
                deriv(1/b_nLw = -1*LD.w)
                igmm;

// simultaneous estimation provides good match despite change to
winitial(identity)
gmm (D.k - {b_kn} *LD.n - {rho_k}*LD.k - {b_kw}*D.w - {b_kLw}*LD.w)
                (D.n - {rho_n}*LD.n - {b_nk} *LD.k - {b_nw}*D.w -
{b_nLw}*LD.w),
                instruments(1:D.w LD.w $xtinstruments, nocons)
                instruments(2:D.w LD.w $xtinstruments, nocons)
                winitial(identity, indep)
                wmatrix(cluster `:char _dta[iis]', indep)
                vce    (cluster `:char _dta[iis]', indep)
                variables(D.k LD.n LD.k D.w LD.w)
                deriv(1/rho_k = -1*LD.k)
                deriv(1/b_kn = -1*LD.n)
                deriv(1/b_kw = -1*D.w)
                deriv(1/b_kLw = -1*LD.w)
                deriv(2/rho_n = -1*LD.n)
                deriv(2/b_nk = -1*LD.k)
                deriv(2/b_nw = -1*D.w)
                deriv(2/b_nLw = -1*LD.w)
                igmm;
#delimit cr

// cross-equation coefficient test
test [b_kn]_cons = [b_nk]_cons

-----Original Message-----
From: Abdalla, Ahmed [mailto:[email protected]]
Sent: Friday, January 31, 2014 9:43 AM
To: David Roodman
Subject: RE: issues with David Droodman's xtabond2

Thanks David
Yes, I read manuals for gmm, xtabond and xtabond2. However I really can't
figure out how to write the code to calculate the Arellano-Bond estimators
for each equation in the system, and test some composite restrictions across
the equations such as
a+b-f+h= c+f-i    !
I posted my question in different ways  in statalist, and got no response. I
have also received a couple of emails from other people referring to my post
at Statalist and asking if I figured out how that could be done, because
they are also doing something similar.
I would much appreciated and acknowledge any advice you give.

Many thanks
Ahmed


PhD candidate and Teaching fellow
Accounting and Financial Management
King's College London



________________________________________
From: David Roodman <[email protected]>
Sent: 29 January 2014 19:24
To: Abdalla, Ahmed
Subject: RE: issues with David Droodman's xtabond2

Dear Ahmed,
        Have you looked at Stata's gmm command? I think it can fit several
equations at once. And I think the documentation provides examples of using
it for Arellano-Bond.
Best,
--David

-----Original Message-----
From: Abdalla, Ahmed [mailto:[email protected]]
Sent: Wednesday, January 29, 2014 2:01 PM
To: [email protected]
Subject: issues with David Droodman's xtabond2

 Dear David
I am a PhD candidate in accounting, King's College London. I thought to
approach you as an author of xtabond2. Any suggestions will be fully
acknowledged.

I am estimating a system of "dynamic" equations in an "unbalanced panel
dataset" such that:
x1 t= a x1t-1 + b x2 t-1 + c x3 t-1 + error1 t
x2 t= e x1t-1 + f x2 t-1 +  g x3 t-1 + error2 t
x3 t= h x1t-1 + i x2 t-1 + j x3 t-1 + error3 t

 My main objective is to test restrictions  on the coefficients (across
equations) that are motivated by theory.
As far as I know, the only possible way to test across-equations
restrictions is  probably to estimate the system as seemingly unrelated
regressions in Stata  using -sureg-However, seemingly unrelated regressions
are inconsistent when lagged dependent variables are included in the RHS
(i.e. dynamic models)

In this case, you have kindly contributed by the Stata command xtabond2
(extending xtabond in Stata) that run Arellano-Bond dynamic panel GMM
estimation.

My inquiries are:

Does xtabond2 extend to estimate a system of equations rather than a single
equation in an unbalaced dataset and allow for testing across equation
restrictions "post estimation" ? is it also possible in xtabond or any other
Stata commands?

Is there any other commands in Stata that can test across equations
restrictions in a system of dynamic models?

Thanks












*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index