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
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.
