Debian Codegraph @

addons/SVAR/examples/Traditional/BlQuah.inp

raw
1 ### Replication of Blanchard and Quah (1989), "The Dynamic Effects of
2 ### Aggregate Demand and Supply Disturbances", AER
3
4 set verbose off
5 include SVAR.gfn
6 open BlQuah.gdt --frompkg=SVAR
7 set seed 1234 # make bootstrap results reproducible
8
9 list X = DY U
10 list exog = const time
11 maxlag = 8
12
13 # set up the model
14 BQModel = SVAR_setup("C", X, exog, maxlag)
15 BQModel.horizon = 40
16
17 # set up the long-run restriction
18 SVAR_restrict(&BQModel, "lrC", 1, 2, 0)
19
20 # name the shocks to something meaningful
21 BQModel.snames = defarray("Supply", "Demand")
22
23 # cumulate the IRFs for variable 1
24 SVAR_cumulate(&BQModel, 1)
25
26 # perform estimation
27 SVAR_estimate(&BQModel)
28
29 # retrieve the demand shocks
30 dShock = GetShock(&BQModel, 2)
31
32 BQModel.biascorr = 2
33 # do bootstrap (set 'quiet' off with trailing zero arg)
34 set stopwatch
35 bfail = SVAR_boot(&BQModel, 1024, 0.9, 0)
36 printf "Number of failed bootstrap iterations = %d, Time (bootstrap) = %g\n", \
37 bfail, $stopwatch
38
39 # page 662 (IRFs)
40
41 SAVE_PLOTS = 0
42
43 if SAVE_PLOTS
44 IRFsave("bq_Ys.pdf", &BQModel, 1, 1)
45 IRFsave("bq_us.pdf", &BQModel, 1, 2)
46 IRFsave("bq_Yd.pdf", &BQModel, -2, 1)
47 IRFsave("bq_ud.pdf", &BQModel, -2, 2)
48 else
49 IRFplot(&BQModel, 1, 1)
50 IRFplot(&BQModel, -2, 1)
51 IRFplot(&BQModel, 1, 2)
52 IRFplot(&BQModel, -2, 2)
53 endif
54
55 # page 664-665 (Historical decompositions)
56
57 list HDDY = SVAR_hd(&BQModel, 1)
58 list HDU = SVAR_hd(&BQModel, 2)
59
60 # cumulate the effect of the demand shock on DY
61 series hd_Y_Demand = cum(hd_DY_Demand)
62
63 # reproduce Figure 8
64 gnuplot hd_Y_Demand --time-series --with-lines --output=display
65 # reproduce Figure 10
66 gnuplot hd_U_Demand --time-series --with-lines --output=display
67 # something more modern
68 HDplot(&BQModel, 2)