About loop problem

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
likykiki
Posts: 11
Joined: Mon Aug 12, 2013 11:42 am

About loop problem

Unread post by likykiki »

I'm trying to use rats to forecast, i write some codes, but it seems the loop does't work,
I want to forecast volatility, use 500 observations to initialize the model, and use the rest of observations(3408) for evaluation, the estimation window of 500 observations is rolled forward daily, and my forecast horizon is 1,5,20,60,120 and 240 days , for example, (tau1 =1, tau2=5), (tau1=41, tau2 =60), but the results seems like i only forecast the volatility of (1,20), (41,60),(101,120),(221,240), and the rest of my forecast horizon is NA, could someone check the code for me? many thanks in advance!
Last edited by likykiki on Sun Aug 18, 2013 9:08 am, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: About loop problem

Unread post by TomDoan »

That seems to be what you wrote. When you combine:

comp step =fix(%IF(tau2>20,20,tau2))

with

do i=500,3908-tau2, step

you're stepping through the data 20 periods at a time once tau2 is 20 or above, and you only do forecasts for the next set of periods beyond i. So your RACTBAR(1) and RFORBAR(1) will be evaluations for i=500, then RACTBAR(2) and RFORBAR(2) will be for i=520.
Post Reply