# Example script for sign restrictions in gretl's SVAR addon set verbose off set seed 909090 include SVAR.gfn ### ### --- Uhlig (2005) example ### # data handling open UhligData.gdt --quiet --frompkg=SVAR series y = 100 * log(RealGDP) series p = 100 * log(CPI) series cp = 100 * log(CommodityPrice) series r = FedFund series nbr = 100 * log(NonBorrReserves) series res = 100 * log(TotalReserves) # set up the model list X = y p cp r nbr res list Z = const scalar order = 12 if 0 ### replicate page 395 (sort of) # set up a "classically-identified" Cholesky model bundle mod0 = SVAR_setup("plain", X, Z, order) mod0.horizon = 60 mod0.snames[4] = "Monetary" SVAR_estimate(&mod0) bfail = SVAR_boot(&mod0, 1024, 0.63) loop i = 1..6 IRFplot(&mod0, 4, i) endloop endif # Switch to a sign restriction model bundle mod = SVAR_setup("SR", X, Z, order) mod.horizon = 60 mod.snames[4] = "Monetary" /* Above the shock #4 is labeled Monetary, and below some sign restrictions are given for it, and no other shock. */ # set up the sign restictions SVAR_SRplain(&mod, "p", "Monetary", "-", 5) # negative from 0 to 5 SVAR_SRplain(&mod, "nbr", "Monetary", "-", 5) # ditto SVAR_SRplain(&mod, "cp", "Monetary", "-", 5) # ditto SVAR_SRplain(&mod, "r", "Monetary", "+", 5) # positive from 0 to 5 # do the rotations (this is the computationally intensive part) # (creating all bundles 'moo' is unnecessary in principle) bundles moo = SVAR_SRdraw(&mod, 256, 1, 0.75) # coverage 75% # draw the irfs (page 397) strings IRFPlots = array(0) # array for storing the plots SVAR_SRirf(mod, mod.Ynames, defarray("Monetary"),, &IRFPlots) # create the plots gridplot IRFPlots --output=display # display in a grid