Page 1 of 1

Rolling Window Forecast with a VAR Model

Posted: Thu Sep 22, 2016 1:02 pm
by tmz
Hi,

I’m trying to run a rolling window forecast with a VAR model. I found a program on this forum (at this page: http://forums.eviews.com/viewtopic.php?t=9752) that I took as a starting point, see below.

My situation:
Observations: 212 (sample: 1999m01 – 2016m08)
Fixed estimation period (rolling window): 156 observations (starting with the sample: 1999m01 – 2011m12)
Forecast horizons: 1 to 8

My goal is to obtain 8 series of forecasted observations, each series corresponding to a different forecast horizon. So, the forecast series with h=1 should have 56 observations (from 2012m01 to 2016m08), the forecast series with h=2 should have 55 observations (from 2012m02 to 2016m08) and so on. My question is, starting with the program below, how can I obtain the 8 forecast series?

Code: Select all

'set window size !window=156 'get size of workfile !length=@obsrange 'set step size !step=1 'declare equation for estimation var var1 'calculate number of rolls !nrolls=@round((!length-!window)/!step) 'variable keeping track of how many rolls we have done !j=0 'move sample !step steps at a time for !i=1 to !length-!window+1-!step step !step !j=!j+1 ' set sample to estimation period smpl @first+!i-1 @first+!i+!window-2 ' estimate equation var1.ls 1 3 a b var1.makemodel(mod1) 'out of sample forecast !ahead=8 '---------------------------------- smpl @first+!i+!window-2 @first+!i+!window-2+!ahead mod1.solve for !h=1 to !ahead if !h+!i+!window<!length then matrix(!ahead,!length-!window) forecasts_a(!h,!i)=a_0(!h+!i+!window-1,1) matrix(!ahead,!length-!window) forecasts_b(!h,!i)=b_0(!h+!i+!window-1,1) else smpl @first @last endif next next

Re: Rolling Window Forecast with a VAR Model

Posted: Wed Jan 05, 2022 6:18 am
by Ekhlas Alhajj
I need to ask when the output come it come in rows like upside down?