Bookmark and Share

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

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

Re: st: Blanchard Quah Decomposition

From   Jorge Eduardo Pérez Pérez <>
To   "" <>
Subject   Re: st: Blanchard Quah Decomposition
Date   Mon, 7 May 2012 14:04:01 -0400

This code replicates Figure 8 of the Blanchard-Quah paper. I don't
know if there is an easier way to produce the structural shocks, I
created them manually. To use this code, you need the paper's dataset,
which is available here:

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)

Jorge Eduardo Pérez Pérez

On Mon, May 7, 2012 at 1:11 PM, James Windsor-Clive
<> wrote:
> Dear Statalist users,
> Apologies if you have answered this already but I am a relative
> newcomer to Stata and this list.
> I have conducted an SVAR using long run restrictions to decompose
> temporary and permanent shocks. I am using the methodology of
> Blanchard and Quah:
> Olivier Jean Blanchard; Danny Quah
> "The Dynamic Effects of Aggregate Demand and Supply Disturbances"
> The American Economic Review, Vol. 79, No. 4. (Sep., 1989), pp. 655-673
> I was wondering if there was a procedure on Stata that extracts the
> structural shock series from the estimated residual series. My aims is
> to manufacture impulse response functions showing the response of
> output to demand and supply shocks. Any guidance would be very much
> appreciated.
> Thanks in advance,
> James
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

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