Hi,
I need to do a rolling forecast for various forecasting horizons (1,4 and 20 quarters). My approach is to make a for loop and then extract the respective observations from the dynamic forecast series. I need to do some manipulation with that data afterwards, which I think will be easier to do in matrix form, therefore I want to save the data in a matrix. Unfortunately I only get NAs with my little program:
' rolling forecast loop
for !i = 1 to !length-!window+1
' set sample to estimation period
smpl @first+!i-1 @first+!i+!window-2
' estimate equation
eq1.ls fx c money interest cpi gdp
' reset sample to forecast period
smpl @first+!i+!window-1 @last
' make forecasts
eq1.forecast(f=na) tmp_yhat
' extract observations according to forecast horizon
forecastmatrix(!i,1) =@elem(tmp_yhat,"@first+!i+!window-1")
forecastmatrix(!i,2) =@elem(tmp_yhat,"@first+!i+!window+2")
forecastmatrix(!i,3) =@elem(tmp_yhat,"@first+!i+!window+18")
next
I have been trying so many things in the last couple of days, searched this forum for hints, but nothing worked. Help would be greatly appreciated, as I'm getting more and more desperate. Thanks!
