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]

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


From   Austin Nichols <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: David Droodman's new contribution for a system of equations: xtabond2
Date   Mon, 3 Feb 2014 18:12:42 -0500

Ahmed <[email protected]>:

You are unlikely to get good answers to a question that includes no
details on the nature of your error messages, but David's code runs
fine for me, and is a very nice illustration IMHO, though I rewrote
some of the long lines using locals so I can cut and paste the whole
thing into the Command window:

webuse abdata, clear
global xtiv
loc tv:char _dta[tis]
sum `tv', mean
qui forv t=`r(min)'/`r(max)' {
foreach var in n k {
 forv lag=2/3 {
  cap drop `var'`t'L`lag'
  g double `var'`t'L`lag' = L`lag'.`var' if `tv' == `t'
  glo xtiv $xtiv `var'`t'L`lag'
  }
 }
}
qui recode $xtiv (. = 0)
xtabond2 k L.n L.k w L.w, iv(w L.w) gmm(n k, lag(2 3)) nolev two r
xtabond2 n L.n L.k w L.w, iv(w L.w) gmm(n k, lag(2 3)) nolev two r
*exact matches using gmm
loc eq1 (D.k-{b_kn}*LD.n-{rho_k}*LD.k-{b_kw}*D.w-{b_kLw}*LD.w)
loc eq2 (D.n-{rho_n}*LD.n-{b_nk}*LD.k-{b_nw}*D.w-{b_nLw}*LD.w)
loc o1 nolog inst(1:D.w LD.w, nocons)
loc o1 `o1' xtinstruments(n k, lags(2/3))
loc o1 `o1'  winitial(xt D)
loc o1 `o1'  wmatrix(cluster `:char _dta[iis]')
loc o1 `o1'  vce    (cluster `:char _dta[iis]')
loc o1 `o1'  variables(D.k LD.n LD.k D.w LD.w)
loc d1  deriv(1/rho_k = -1*LD.k)
loc d1 `d1'  deriv(1/b_kn = -1*LD.n)
loc d1 `d1'  deriv(1/b_kw = -1*D.w)
loc d1 `d1'  deriv(1/b_kLw = -1*LD.w)
loc d2  deriv(1/rho_n = -1*LD.n)
loc d2 `d2'  deriv(1/b_nk = -1*LD.k)
loc d2 `d2'  deriv(1/b_nw = -1*D.w)
loc d2 `d2'  deriv(1/b_nLw = -1*LD.w)
gmm `eq1', `o1' `d1' two
gmm `eq2', `o1' `d2' two
*now switch to igmm--changes coefs a little
gmm `eq1', `o1' `d1' igmm
gmm `eq2', `o1' `d2' igmm
*simult. est. provides good match despite change to winitial(id)
loc o2 nolog inst(1:D.w LD.w $xtiv, nocons)
loc o2 `o2'  inst(2:D.w LD.w $xtiv, nocons)
loc o2 `o2'  winitial(identity, indep)
loc o2 `o2'  wmatrix(cluster `:char _dta[iis]', indep)
loc o2 `o2'  vce    (cluster `:char _dta[iis]', indep)
loc o2 `o2'  variables(D.k LD.n LD.k D.w LD.w)
loc o2 `o2'  deriv(1/rho_k = -1*LD.k)
loc o2 `o2'  deriv(1/b_kn = -1*LD.n)
loc o2 `o2'  deriv(1/b_kw = -1*D.w)
loc o2 `o2'  deriv(1/b_kLw = -1*LD.w)
loc o2 `o2'  deriv(2/rho_n = -1*LD.n)
loc o2 `o2'  deriv(2/b_nk = -1*LD.k)
loc o2 `o2'  deriv(2/b_nw = -1*D.w)
loc o2 `o2'  deriv(2/b_nLw = -1*LD.w)
gmm `eq1' `eq2', `o2' igmm
*cross-equation coefficient test
test [b_kn]_cons = [b_nk]_cons


On Mon, Feb 3, 2014 at 5:25 PM, Abdalla, Ahmed <[email protected]> wrote:
> 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: 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