Recursive-Pls help.

For questions regarding programming in the EViews programming language.

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

mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

Recursive-Pls help.

Postby mjfl » Tue Jul 19, 2011 9:57 pm

Code: Select all

'create a variable series y = dlhs series x = dpiet series z= m1d 'create empty equation to be used inside the loop equation eq 'variable to store the minimum AIC. Initialise it to a large number !sc = 9999999 'variable saying how many lags to go up to !maxlags = 4 'Variable to store the "best" number of lags !bestlag = 0 !best2lag = 0 for !horizon= 100 to105 smpl 1974q1 1974q1+!horizon equation eq{!horizon} for !i=0 to !maxlags for !j=0 to !maxlags eq{!horizon}.ls(cov=hac) y c x( to -!i) z( to -!j) 'run regression of Y on a constant and lagged values of itself up to the iTH lag. if eq{!horizon}.@sc < !sc then !best2lag =!j !bestlag = !i 'if this lag specification has the best AIC, then store this lag as !bestlag. !sc = eq{!horizon}.@sc endif next next next
hi,

i have a couple of quries. i think im closing in but need some help. have beene waiting on other threads too. pls do reply if you can eviews team. much appreciated.

1. as above, i get eqn 100 101 102 103 104 105. but all chooses 4lags. how can i seperate them so that at each loop they choose their own best lags? e.g. t=100, best lag is -2, t=101, best lag is -3 etc etc.

2. i can do the normal forecasting after the eqns pops out. but how can i only get the forecasted VALUE just after the sample sample period. i.e. sample 1990 to 2000. then forecast value for 2001. sample 1999 to 2001, then forecast value for 2002? is it possible that each eqn give me a forecast value of which i can APPEND to a series that starts at the right time? Is that possible?

thank you gareth jason and fellow eveiws team. on my master thesis.

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

Recursive-Pls help.

Postby EViews Gareth » Tue Jul 19, 2011 10:14 pm

1) I think it is doing what you want it to do.

2) Just set the sample to be the one observation you want to forecast, then forecast.

mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

Re: Recursive-Pls help.

Postby mjfl » Tue Jul 19, 2011 11:36 pm

Hi Gareth,

im sorry but its not doing what i meant.

1) as mentioned, the lags does not change for every loop. how can i set horizon=100, eqn is fitted with right lags then horizon=101, eqn is fitted with another lag structure?
2) now that it has generated 5 eqn, for y_hat forecast i used:

smpl 2001q1 2001q2
eq{!horizon}.fit y_hat{!horizon} y_se{!horizon}
but there is no output at all.

3) is there anyway to lump these generated values in a series together?

once again, thank you.

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

Re: Recursive-Pls help.

Postby EViews Gareth » Wed Jul 20, 2011 7:51 am

1) Obviously I can only tell by looking at the code, rather than looking at the results, but I think the code is doing what you describe. How do you know it isn't?

2) There should be output of a series called y_hat101 and y_se101 etc.... Are you saying that those series are not created?

3) You can assign into another series if you want them all together. For example:

Code: Select all

series master_series = y_hat{!horizon}

mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

Re: Recursive-Pls help.

Postby mjfl » Wed Jul 27, 2011 1:52 am

hi gareth that was realli useful.
im tyring to twitch it to do arma model where they choose the best ar and ma but it cant work.
pls advice.

Code: Select all

series y = dlhs equation eq !sc = 9999999 !maxlags = 6 !bestlag = 0 !best2lag = 0 for !horizon= 119 to 147 smpl 1974q1 1974q1+!horizon equation eq{!horizon} for !i=1 to !maxlags for !j=1 to !maxlags eq{!horizon}.ls(cov=hac) y c ar((1) to (!i)) ma((1) to (!j)) if eq{!horizon}.@sc < !sc then !best2lag =!j !bestlag = !i !sc = eq{!horizon}.@sc endif next next eq{!horizon}.ls(cov=hac) y c ar((1) to (!bestlag)) ma((1) to (!best2lag)) next
may i know why i cant feed ar(1 to 6) and ma(1 to 7) but can do it for a series x(1 to 6) y(1 to 6)??
how should i twitch it?
thk u.

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

Recursive-Pls help.

Postby EViews Gareth » Wed Jul 27, 2011 6:48 am

EViews just doesn't support the AR(a to b) syntax.

mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

Re: Recursive-Pls help.

Postby mjfl » Wed Jul 27, 2011 7:07 am

hi gareth,

thks for the fast reply. haha i tried my lungs out. and cant find in command as well.
is there anyway you would recommend?
thats like the tip of the iceberg.

thks in advance.

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

Re: Recursive-Pls help.

Postby EViews Gareth » Wed Jul 27, 2011 7:49 am


mjfl
Posts: 49
Joined: Mon Jul 18, 2011 8:18 am

Re: Recursive-Pls help.

Postby mjfl » Thu Aug 04, 2011 8:22 am

thks gareth the arma works.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests