Page 1 of 1

Trouble with Kilian(1998) and time TREND

Posted: Wed Jul 13, 2016 7:59 am
by ijt
Hi,

I am currently working on a VAR with Kilian(1998) bias-correction on the IRF. The code seemed to work perfectly fine when I estimated the VAR with det CONSTANT. However, two of my variables present a linear time trend, so I constructed a "TREND = t" variable. But when using DET CONSTANT TREND, the following error appear:

## MAT2. Matrices with Dimensions 14 x 3 and 13 x 3 Involved in + Operation
The Error Occurred At Location 341, Line 33 of KILIANBOOTSETUP

I looked up the killianbootsetup and varbootsetup programs themselves, but could not figure out what is going on. I would extremely aprecciate some help on this issue.
Thank you very much!


Below is my code:

Code: Select all

CALENDAR(Q) 1996:1
DATA(FORMAT=WF1) 1996:01 2015:04 C01 CONFIANCAS___NAO_USEI_ES EXPECT_INFL_ FBKF IBGE_DESSAZ_PIB ICC_FGV $
 ICEA_FECOM ICI_FGV IEC_FECOM IPCA_INDICE IPCA_INDICE_SA IPCA_QOQ__A_ IPCA_QOQ_SA IPCA_QOQ_SA_ANN JURO_REAL $
 MEDIA_SELIC RESID

set TREND = t
set L_CONS = log(C01)
set L_PIB = log(IBGE_DESSAZ_PIB)
set L_IEC = log(IEC_FECOM)

SYSTEM(Model=VAR_TRIVARIADO)
VARIABLES L_IEC L_CONS L_PIB
LAGS 1 TO 4
DET Constant TREND
END(SYSTEM)
ESTIMATE(outsigma=varcov)

eigen(cvalues=cv) %modelcompanion(VAR_TRIVARIADO)
disp %cabs(cv(1))

compute nsteps=40
compute ndraws=1000
compute nshocks=1

estimate(resids=resids)
compute nvar=%nvar
compute rstart=%regstart(),rend=%regend()

@KilianBootSetup(model=VAR_TRIVARIADO,resids=resids) rstart rend
declare vect[rect] %%responses(ndraws)
*
infobox(action=define,lower=1,upper=ndraws,progress) $
   "Second stage bootstrap"
do draw=1,ndraws
   @KilianBootDraw(resids=resids) rstart rend
   impulse(model=%%VARReModel,shocks=%unitv(nvar,1),steps=nsteps,factor=varcov*inv(%diag(%sqrt(%xdiag(varcov)))),$
      flatten=%%responses(draw),noprint)
/*   impulse(model=%%VARReModel,shocks=%unitv(nvar,1),steps=nsteps,$
      flatten=%%responses(draw),noprint)*/
   infobox(current=draw)
end do draw
infobox(action=remove)
*
@MCProcessIRF(percentiles=||.05,.95||,lower=klower,upper=kupper,$
   irf=kmedian,model=%%VARReModel)
*
spgraph(hfields=3,footer="Bootstrapped Responses to unit shock in IEC")
 graph(number=0,header="CONSUMO") 3
 # kmedian(2,1)
 # klower(2,1) / 2
 # kupper(2,1) / 2
 graph(number=0,header="PIB") 3
 # kmedian(3,1)
 # klower(3,1) / 2
 # kupper(3,1) / 2
 graph(number=0,header="IEC") 3
 # kmedian(1,1)
 # klower(1,1) / 2
 # kupper(1,1) / 2
spgraph(done)

Re: Trouble with Kilian(1998) and time TREND

Posted: Mon Jul 25, 2016 6:12 pm
by TomDoan
We've posted a revised version of VARBOOTSETUP which can handle different deterministic variables. If you have RATS 8.3 or later, you can use the Update Procedures operation to replace what you currently have.