lag selection with two independent variables
Posted: Tue Jul 21, 2009 9:58 am
Hi everybody
I try to write a code that can make lag selection for 2 independent variables according to information criterion. The following code does not work. If anyone can help I appreciate with that.
for %y ainf1 ainf2 ainf3 ainf4 ainf5 ainf6
equation eq_{%y}
!mininfocrit=999999
for !lag=-4 to -1
for !lag2=-4 to -1
%regs=""
for !j=-4 to !lag
for !k=-4 to !lag2
%regs=%regs + "ainf(" + @str(!j) + " )" + "tr121(" + @str(!k) + " ) "
next
next
next
eq_{%y}.ls {%y} c {%regs}
if eq_{%y}.@aic<!mininfocrit then
!bestlag=!lag
!bestlag2=!lag2
!mininfocrit=eq_{%y}.@aic
endif
Next
eq_{%y}.ls {%y} c tr121(0 to !bestlag2) ainf(0 to !bestlag)
Next
I try to write a code that can make lag selection for 2 independent variables according to information criterion. The following code does not work. If anyone can help I appreciate with that.
for %y ainf1 ainf2 ainf3 ainf4 ainf5 ainf6
equation eq_{%y}
!mininfocrit=999999
for !lag=-4 to -1
for !lag2=-4 to -1
%regs=""
for !j=-4 to !lag
for !k=-4 to !lag2
%regs=%regs + "ainf(" + @str(!j) + " )" + "tr121(" + @str(!k) + " ) "
next
next
next
eq_{%y}.ls {%y} c {%regs}
if eq_{%y}.@aic<!mininfocrit then
!bestlag=!lag
!bestlag2=!lag2
!mininfocrit=eq_{%y}.@aic
endif
Next
eq_{%y}.ls {%y} c tr121(0 to !bestlag2) ainf(0 to !bestlag)
Next