rolling window help

For questions regarding programming in the EViews programming language.

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

g_anluca
Posts: 1
Joined: Tue Apr 21, 2009 11:21 am

rolling window help

Postby g_anluca » Tue Apr 21, 2009 12:41 pm

greetings everyone!

i am trying to do a rolling window static forecast out of a simple ECM model but i cannot manage to obtain the complete forecast: that is when i look in the forecast output (wtifore) i only get the results for the last iteration of the loop. here's the code

scalar obs=5490
scalar window= 500

for !i = window to obs-window

smpl !i-window+1 !i
equation prova_ecm
prova_ecm.ls d(wti) c d(wti_f3) u(-1)

smpl !i+1 !i+window
prova_ecm.fit wtifore


next

smpl @all


i know i should create something to contain the forecasted values after each iteration to avoid overwriting them, but i just can't figure out how. can anyone help me?

tx in advance [edit: i'll attach also the wf]
Attachments
ecm.WF1
(186.07 KiB) Downloaded 462 times

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: rolling window help

Postby trubador » Fri May 01, 2009 3:10 am

Try this way:

Code: Select all

scalar obs=5490 scalar window= 500 matrix(window,obs-2*window+1) results for !i = window to obs-window smpl !i-window+1 !i equation prova_ecm prova_ecm.ls d(wti) c d(wti_f3) u(-1) sample s !i+1 !i+window prova_ecm.fit wtifore stom(wtifore,rvector,s) colplace(results,rvector,!i-window+1) delete s rvector next smpl @all


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests