Page 1 of 1

storing step ahead forecasts from ADL model in a series.

Posted: Wed Nov 20, 2013 11:57 am
by ttobias
Hello,

Im trying to estimate and forecast an ADL(1,1) model and get h-step ahead forecasts.
in my example i want to use my sample and then estimte 12 months ahead

my code:

!h = 12
%start ="2000m01"
%end ="2009m12"

smpl %start %end
equation adl_1.ls unrate c initial_claims(-1) unrate(-1)
adl_1.makeresid adl_1_resid

smpl %end+1 %end+!h
adl_1.forecast(f=na) fcast_adl_1_temp

series fcast
fcast = fcast_adl_1_temp

fcast contains 12 observations, and i guess the first one is one step ahead and the last is 12 steps ahead?

thanks

/t

Re: forecasting adl(1,1) for different horizons

Posted: Wed Nov 20, 2013 12:00 pm
by EViews Gareth
Right.

Re: forecasting adl(1,1) for different horizons

Posted: Wed Nov 20, 2013 1:40 pm
by ttobias
thanks for the quick answer! the last thing i want to do is a rolling window estimation !outs number of times and store the !h forecast for each window.

my attempt

!h = 3
!outs = 2
%start ="2000m01"
%end ="2009m12"

series fcast

for !i = 1 to !outs

smpl %start+!i-1 %end+!i-1
equation adl_{!i}.ls unrate c initial_claims(-1) unrate(-1)
adl_{!i}.makeresid adl_{!i}_resid

smpl %end+!i %end+!h+!i-1
adl_{!i}.forecast(f=na) fcast_adl_{!i}

fcast = fcast_adl_{!i}(%end+!h+!i-1)

next

in the code its these forecasts i want to store.

fcast = fcast_adl_1(2010m03)
fcast = fcast_adl_2(2010m04)

but i get an error saying:

2010m03 is not a valid index for FCAST_ADL_1 in "GENR FCAST = FCAST_ADL_1(2010m03)

so how do i access and store only those observations?

thanks again!

t

Re: storing step ahead forecasts from ADL model in a series.

Posted: Fri Nov 22, 2013 8:13 am
by ttobias
i think i solved it. does it look correct?

here is the code if someone else should ever be interested.


!h = 3
!outs = 2
%start ="2000m01"
%end ="2009m12"

series fcast

for !i = 1 to !outs

'roll sample one step ahead, first one is unchanged
smpl %start+!i-1 %end+!i-1

' estimate the model using the insample set above
equation adl_{!i}.ls unrate c initial_claims(-1) unrate(-1)
adl_{!i}.makeresid adl_{!i}_resid

'set the outsample, need to be !h length
smpl %end+!i %end+!h+!i-1
adl_{!i}.forecast(f=na) fcast_adl_{!i}

'store the !h prediction from each forecast (index starts at zero)
fcast = fcast_adl_{!i}(!h-1)

next