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]

st: Blanchard & Quah decomposition


From   "Ángela Fajardo Moreno" <aafajardom@unal.edu.co>
To   statalist@hsphsun2.harvard.edu
Subject   st: Blanchard & Quah decomposition
Date   Sun, 23 Jun 2013 19:46:48 -0500

> Hi users,
> 
> I need to get the 7, 9 and 10 figures of the Blanchard-Quah paper "The Dynamic Effects of Aggregate Demand and Supply Disturbances". I found the next programmation in the stata archive about how to get the Figure 8 of the paper (Output fluctuations due to demand). Do someone know how to modified this programmation to get those figures? I really appreciate any help from you.
> 
> use "${dir}\datos\bqdata.dta"
> tsset date
> 
> gen loggnp=log(gnp)
> gen loggd=log(gd87)
> gen logrgnp=loggnp-loggd+log(100)
> gen dlogrgnp=100*d.logrgnp
> 
> * Extract separate means from the GNP growth series. Save the fitted
> values for* rebuilding the data later.
> 
> gen d1=(date<=tq(1973q4))
> gen d2=(date>tq(1973q4))
> 
> reg dlogrgnp d1 d2, nocons
> predict gdpadjust, resid
> predict means_from_gnp
> 
> * gen gdpadjust=dlogrgnp
> * Remove a linear trend from unemployment
> gen trend=_n
> reg lhmur trend
> predict uradjust, resid
> predict trend_from_ur
> 
> matrix c=(.,0\.,.)
> svar gdpadjust uradjust, lags(1/8) lreq(c)
> 
> * Get structural shocks
> matrix B=e(B)
> predict e1, res eq(gdpadjust)
> predict e2, res eq(uradjust)
> mkmat e1 e2, matrix(e)
> matrix eta=(inv(B)*e')'
> svmat eta
> * Zero out demand shocks and generate reduced form shocks again
> replace eta2=0
> mkmat eta1 eta2, matrix(eta)
> matrix e=B*eta'
> * Generate forecast with zeroed out shocks
> matrix A1=e(A1)
> matrix F=(inv(A1)*e)'
> svmat F
> * Add means back
> replace F1=F1+means_from_gnp
> replace F1=sum(F1)*0.01
> sum date if e(sample)
> local a=r(min)-1
> * Add initial values back
> sum logrgnp if date==`a'
> replace F1=F1+r(mean)
> ren F1 bq_trend
> gen bq_gap=logrgnp-bq_trend
> * Figure 8
> tsline bq_gap if date>=tq(1950q1)
> 
> Enviado desde mi iPad

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index