Variance Decompositions based on a Rolling VAR

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

Variance Decompositions based on a Rolling VAR

Unread post by ege_man »

Dear Tom,
I am trying to compute forecast error decompositions based on the rolling VAR estimate so I wrote the following code. But the output looks like a recursive since I have more results than expected. Can you please tell me what is wrong with this code? Besides Can you please show me how to extract a table including the results of the whole sample?

I would like adjust this code for also weekly data later.

Best Regards

Code: Select all

compute lags=2;*Number of lags
compute nstep=13		;*Number of response steps
*
open data 2015_fuel_diff.xls
calendar(m) 1992
data(format=xls,org=columns) 1992:2 2013:10
table
compute nspan=36
do time= 1996:4, 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) time-nspan+1 time
errors(model=fuel, steps=nstep, results=vardec, noprint)
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 primat
end do time
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Variance Decompositions based on a Rolling VAR

Unread post by TomDoan »

You should be getting five numbers per time period, over about 200 windows. Isn't that what you want? However, those windows are way too small for that size model. You're taking out almost half the degrees of freedom, so the values will be very poorly estimated.

If you want a "table", the best thing to do is to create a report and insert the date and the five FEVD numbers in each pass through the loop.

You should pull the system definition outside the loop---nothing in that depends upon the time period.
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

Re: Variance Decompositions based on a Rolling VAR

Unread post by ege_man »

Yes That is what I am looking for only lets say five estimates, but I am still getting 161 variance decomposition results in the code below, I don't know what is wrong.

Code: Select all

compute lags=2;*Number of lags
compute nstep=13		;*Number of response steps
*
open data 2015_fuel_diff.xls
data(format=xls,org=columns)
compute nbonds=261
all nbonds
table

compute nspan=50
system(model=fuel)
variables  oil er dis pri ip
lags 1 to lags
det constant ffr{1} ipus{1}
end(system)
do time= 100, 261
estimate(resids=varresids, noprint) time-nspan+1 time
errors(model=fuel, steps=nstep, results=vardec, noprint)
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 primat
end do time
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Variance Decompositions based on a Rolling VAR

Unread post by TomDoan »

What you are getting are rolling estimates of a variance decomposition. If that's not what you want, you'll have to explain what you DO want.
Post Reply