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!
About loop problem
About loop problem
Last edited by likykiki on Sun Aug 18, 2013 9:08 am, edited 1 time in total.
Re: About loop problem
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.
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.