Rolling Window Forecast with a VAR Model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

tmz
Posts: 6
Joined: Wed Aug 12, 2015 12:21 pm

Rolling Window Forecast with a VAR Model

Postby tmz » Thu Sep 22, 2016 1:02 pm

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

Ekhlas Alhajj
Posts: 1
Joined: Tue Jan 04, 2022 6:55 am

Re: Rolling Window Forecast with a VAR Model

Postby Ekhlas Alhajj » Wed Jan 05, 2022 6:18 am

I need to ask when the output come it come in rows like upside down?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests