Debian Codegraph @

addons/SVAR/examples/Traditional/bias_correction.inp

raw
1 set verbose off
2 include SVAR.gfn
3
4 function list GenerateExampleData(scalar phi, scalar T)
5 /*
6 this function returns pseudorandom data according to
7 the DGP used in Kilian (1998)
8 */
9 K = cholesky({1, 0.3; 0.3, 1})
10 A = {phi, 0; 0.5, 0.8}
11 U = mnormal(T, 2) * K'
12 Y = varsimul(A, U, zeros(1,2))
13 list ret = null
14 loop i = 1..2
15 series y$i = Y[2:,i]
16 ret += y$i
17 endloop
18 return ret
19 end function
20
21 /* ------------------------------------------------------ */
22
23 nulldata 200
24 set seed 54321
25 setobs 1 1 --special-time-series
26 list Y = GenerateExampleData(0.95, $nobs)
27
28 Model = SVAR_setup("plain", Y, null, 1)
29 Model.horizon = 20
30 SVAR_estimate(&Model)
31
32 SVAR_boot(&Model, 1000, 0.95)
33 IRFplot(&Model, 1, 1)
34 IRFplot(&Model, 1, 2)
35
36 Model.biascorr = 1
37 SVAR_boot(&Model, 1000, 0.95)
38 IRFplot(&Model, 1, 1)
39 IRFplot(&Model, 1, 2)
40
41 Model.biascorr = 2
42 SVAR_boot(&Model, 1000, 0.95)
43 IRFplot(&Model, 1, 1)
44 IRFplot(&Model, 1, 2)