Code: Select all
series k=djia
for !horizon= 58 to 82
smpl 1989q1 1989q1+!horizon
k.hpf(lambda=1600) k_hp{!horizon}
series k_c{!horizon} = k - k_hp{!horizon}
next
smpl @all
series y = dlhs
series x = dpiet
equation eq
!sc = 9999999
!maxlags = 4
!bestlag = 0
!best2lag = 0
for !horizon= 59 to 82
smpl 1989q1 1989q1+!horizon
equation eq{!horizon}
for !i=0 to !maxlags
for !j=0 to !maxlags
eq{!horizon}.ls(cov=hac) y c x( to -!i) k_c{!horizon}( 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 x( to -!bestlag) k_c{!horizon}( to -!best2lag)
smpl 1989q1+!horizon+1 1989q1+!horizon+1
eq{!horizon}.fit(f=na) y_hat{!horizon} y_se{!horizon}
series master_series = y_hat{!horizon}
series ee= (dlhs - y_hat{!horizon})^2
next
smpl @all
scalar m = sqr((1/24)*@sum(ee))
show m
Code: Select all
smpl @all
series y = dlhs
series x = dpiet
equation eq
!sc = 9999999
!maxlags = 4
!bestlag = 0
!best2lag = 0
for !horizon= 59 to 82
smpl 1989q1 1989q1+!horizon
equation eq{!horizon}
for !i=0 to !maxlags
for !j=0 to !maxlags
eq{!horizon}.ls(cov=hac) y c x( to -!i) k_c{!horizon}( 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 x( to -!bestlag) k_c{!horizo}( to -!best2lag)
thats where it cant 'UNABLE TO FIT DUE TO MISSING DATA EQN59............
i tried to seperate the 2 for loop into one running called eq{!horizon} and then k_c{!hori} but it does not work. can i seek help?
