storing step ahead forecasts from ADL model in a series.

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ttobias
Posts: 3
Joined: Wed Nov 20, 2013 11:42 am

storing step ahead forecasts from ADL model in a series.

Postby ttobias » Wed Nov 20, 2013 11:57 am

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
Last edited by ttobias on Fri Nov 22, 2013 5:15 am, edited 1 time in total.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Wed Nov 20, 2013 12:00 pm

Right.

ttobias
Posts: 3
Joined: Wed Nov 20, 2013 11:42 am

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

Postby ttobias » Wed Nov 20, 2013 1:40 pm

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

ttobias
Posts: 3
Joined: Wed Nov 20, 2013 11:42 am

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

Postby ttobias » Fri Nov 22, 2013 8:13 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests