Page 1 of 1

About loop problem

Posted: Fri Aug 16, 2013 8:15 am
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!

Re: About loop problem

Posted: Fri Aug 16, 2013 9:51 am
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.