recursive responses from Linear VAR

Questions and discussions on Vector Autoregressions
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

recursive responses from Linear VAR

Unread post by ege_man »

Dear Tom,
Since I found unexpected signs for some of the responses obtained from the modified version of the Primiceri code, I would like to compare the responses computed from recursively estimated linear VAR model with the one obtained from Primiceri code.
Is there any available code for this?
Thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: recursive responses from Linear VAR

Unread post by TomDoan »

ege_man wrote:Dear Tom,
Since I found unexpected signs for some of the responses obtained from the modified version of the Primiceri code, I would like to compare the responses computed from recursively estimated linear VAR model with the one obtained from Primiceri code.
Is there any available code for this?
Thanks
I'm not sure what you're trying to shut down in the Primiceri model. Stochastic volatility? Time variation? Both?
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

Re: recursive responses from Linear VAR

Unread post by ege_man »

Dear Tom,
I am still working on the Primiceri code and I will post as soon as I finish it.
I wrote the following code to produce recursive variance decomposition for price (p) and industrial production (ip) to see the evolution of the variance explained by the variables over time. The code is running properly but it produce more than 250 tables for each sample. But I just want to pick the decomposition of the last two variables for only 12th horizon over the sample period. Is it possible to create tables or bar charts using results instruction in Errors procedure? In the current the results obtained from the last VAR model are saved in vardec vector.

Thanks.
ps. I am using RATS version 8.3.

Code: Select all

compute lags=2;*Number of lags
compute nstep=12		;*Number of response steps
*
open data 2015_fuel_diff.xls
calendar(m) 1992
data(format=xls,org=columns) 1992:2 2013:10
table
compute [vect[strings]] implabel=|| "oil","er", "fuel", "p", "ip"||
do j=1,251
smpl 1992:02 1992:12+j
system(model=fuel)
variables  oil er dis pri ip
lags 1 to lags
det constant ffr{1} ipus{1}
end(system)
estimate(resids=varresids, noprint) 1992:02 1992:12+j
errors(model=fuel, steps=nstep, results=vardec, window="variance decomposition", noprint)
end do j
table
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: recursive responses from Linear VAR

Unread post by TomDoan »

Sure, you can pull information about the FEVD out of the VARDEC matrix---that's what the RESULTS option is for.
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

Re: recursive responses from Linear VAR

Unread post by ege_man »

Dear Tom,
Thanks. But the current version gives FEVD for only the last VAR. Could you please guide me how to modify the code above?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: recursive responses from Linear VAR

Unread post by TomDoan »

You'll have to put something inside the loop to put the information that you want somewhere else. Presumably, you would want to fill elements of a VECT[SERIES] with the values that you want.
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

Re: recursive responses from Linear VAR

Unread post by ege_man »

Dear Tom,
Here is the modified version of the code using user guide examples. As you see I create two matrices primat and ipmat including the 12th horizon FEVD for each sample. I would really appreciate if you show me how to convert these matrices into series changing over time.
Thanks

Code: Select all

compute lags=2;*Number of lags
compute nstep=16		
*
open data 2015_fuel_diff.xls
calendar(m) 1992
data(format=xls,org=columns) 1992:2 2013:10

compute [vect[strings]] implabel=|| "oil","er", "fuel", "p", "ip"||
do time=1992:5,2013:10
system(model=fuel)
variables  oil er dis pri ip
lags 1 to lags
det constant ffr{1} ipus{1}
end(system)
estimate(resids=varresids, noprint)
errors(model=fuel, steps=nstep, results=vardec, noprint)
com i11 = vardec(5,1)(12), i12 = vardec(5,2)(12) , i13 = vardec(5,3)(12) , i14 = vardec(5,4)(12), i15= vardec(5,5)(12)
com [rect[real]] ipmat = ||i11, i12,  i13, i14, i15||
dis 'variance decomposition of IP'
dis ipmat
com i11pri = vardec(4,1)(12), i12pri = vardec(4,2)(12) , i13pri = vardec(4,3)(12) , i14pri = vardec(4,4)(12), i15pri= vardec(4,5)(12)
com [rect[real]] primat = ||i11pri, i12pri,  i13pri, i14pri, i15pri||
dis 'variance decomposition of PRI'
dis primat
end do time
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: recursive responses from Linear VAR

Unread post by TomDoan »

system(model=fuel)
variables oil er dis pri ip
lags 1 to lags
det constant ffr{1} ipus{1}
end(system)

should be outside the loop, not inside.

As I said, you want to set up a VECT[SERIES] and put the information into element TIME of the members of that. (You could also do a SERIES[VECT], but that's probably not as convenient).
Post Reply