Page 1 of 1
Recursive-Pls help.
Posted: Tue Jul 19, 2011 9:57 pm
by mjfl
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.
Recursive-Pls help.
Posted: Tue Jul 19, 2011 10:14 pm
by EViews Gareth
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.
Re: Recursive-Pls help.
Posted: Tue Jul 19, 2011 11:36 pm
by mjfl
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.
Re: Recursive-Pls help.
Posted: Wed Jul 20, 2011 7:51 am
by EViews Gareth
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}
Re: Recursive-Pls help.
Posted: Wed Jul 27, 2011 1:52 am
by mjfl
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.
Recursive-Pls help.
Posted: Wed Jul 27, 2011 6:48 am
by EViews Gareth
EViews just doesn't support the AR(a to b) syntax.
Re: Recursive-Pls help.
Posted: Wed Jul 27, 2011 7:07 am
by mjfl
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.
Re: Recursive-Pls help.
Posted: Wed Jul 27, 2011 7:49 am
by EViews Gareth
Re: Recursive-Pls help.
Posted: Thu Aug 04, 2011 8:22 am
by mjfl
thks gareth the arma works.