Forecast using recursive (expanding) estimation window

For questions regarding programming in the EViews programming language.

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Forecast using recursive (expanding) estimation window

Postby EViews Gareth » Wed Jun 13, 2012 10:38 am

The point is that you have a workfile that only has 300 observations. You're then trying to set the sample to be observation 301. That doesn't exist, hence the error message.

dmilanc
Posts: 6
Joined: Tue Jun 12, 2012 10:24 am

Re: Forecast using recursive (expanding) estimation window

Postby dmilanc » Sat Jul 07, 2012 12:43 pm

Dear all,

As I told before, I am trying to build a rolling var forecast. The basic ideia is to build forecasts for "n" periods ahead as if the set of informational available is limited until certain data.

So far I had the following code:

Code: Select all

'create a group of dummies group dummies jan fev mar abr mai jun jul ago set out nov 'declare data as series series y= ipca12m series x1= d_cambio series x2= selic series x3=hiato_rolling 'amostra com inicio em jun95=1 'primeira previsao 12 passos a frente para jan99 = 44 na amostra !inicio = 31 !step = 12 'create vector to store 146 predictions (jan99 - fev11). vector(146) y_hat 'counter of loops !rowcounter=1 'define loop ' Ate 145 => previsao ate fev12 for !i=0 to 145 smpl @first @first+!inicio+!i var var1.ls 1 2 x3 y x1 x2 @ dummies 'ordenamento do var: x3->y->x1->x2 ' Dynamic Forecast VAR var1.makemodel(mod1) smpl @first+3 @first+!inicio+!i+!step 'define last value of the sample !previsao = !inicio+!i+!step+1 'dinamic model mod1.solve(d=d) 'keep ys series series y_0_{!i} = y_0 'freeze the predicted values freeze(tabley_0_{!i}) y_0_{!i} 'store the last predicted @ the vector y_hat y_hat(!rowcounter)= (y_0_{!i} (!previsao)) !rowcounter=!rowcounter+1 d tabley_0_{!i} 'delete the frozen table next smpl @all
However, when I tested the code (manually) I realized that it was not working properly... as it seems to be using more information than it should in order to build its predictions.

For the sake of simplicity, I'll try to write an example of what it should be exactly doing, so, maybe, it gets easier for you guys to help me out. Here goes:

For i = 0 it should make the prediction considering all the info available (in each series) from @first until @first+31.
But the sample for the model to build predictions should be @first until @first+31+12, where the last 12 info (in each series ) should read as N/A...
In this case the model would build a prediction as if the only available info was from @first until @first+31...

With the code I built so far, I guess the only thing I'm still missing is how to set the proper range and/or sample to build the model. Could you help me with this step?

Thanks in advance.
Best regards.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Forecast using recursive (expanding) estimation window

Postby EViews Gareth » Mon Jul 09, 2012 9:01 am

I'm not really sure I understand what you're saying. The code looks, to me, as though it should work.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests