| 1 |
# Example script for sign restrictions in gretl's SVAR addon |
| 2 |
|
| 3 |
set verbose off |
| 4 |
set seed 909090 |
| 5 |
|
| 6 |
include SVAR.gfn |
| 7 |
|
| 8 |
### ---------------------------------------------------- |
| 9 |
### Ouliaris et al's example on the Cho_Moreno dataset |
| 10 |
### see https://www.eviews.com/StructVAR/structvar.html |
| 11 |
### ---------------------------------------------------- |
| 12 |
|
| 13 |
# data handling (original file chomoreno.wf1) |
| 14 |
|
| 15 |
open chomoreno_fromeviewswf.gdt --quiet --frompkg=SVAR |
| 16 |
|
| 17 |
# set up the model |
| 18 |
|
| 19 |
list X = GAP INFL FF |
| 20 |
list Z = const |
| 21 |
scalar order = 2 |
| 22 |
|
| 23 |
bundle mod = SVAR_setup("SR", X, Z, order) |
| 24 |
mod.horizon = 32 |
| 25 |
|
| 26 |
# set up the sign restictions |
| 27 |
|
| 28 |
mod.snames = defarray("Demand", "Cost Push", "Interest Rate") |
| 29 |
|
| 30 |
SVAR_SRplain(&mod, "GAP", "Demand", "+") |
| 31 |
SVAR_SRplain(&mod, "INFL", "Demand", "+") |
| 32 |
SVAR_SRplain(&mod, "FF", "Demand", "+") |
| 33 |
|
| 34 |
SVAR_SRplain(&mod, "GAP", "Cost Push", "-") |
| 35 |
SVAR_SRplain(&mod, "INFL", "Cost Push", "+") |
| 36 |
SVAR_SRplain(&mod, "FF", "Cost Push", "+") |
| 37 |
|
| 38 |
SVAR_SRplain(&mod, "GAP", "Interest Rate", "-") |
| 39 |
SVAR_SRplain(&mod, "INFL", "Interest Rate", "-") |
| 40 |
SVAR_SRplain(&mod, "FF", "Interest Rate", "+") |
| 41 |
|
| 42 |
# do the rotations (this is the computationally intensive part) |
| 43 |
SVAR_SRdraw(&mod, 256, 0, 0.95, 5000) |
| 44 |
|
| 45 |
# draw the irfs |
| 46 |
gpbuild Plots |
| 47 |
SVAR_SRirf(mod, mod.Ynames, mod.snames) |
| 48 |
end gpbuild |
| 49 |
|
| 50 |
gridplot Plots --output=display |