Group Object in a loop
Posted: Fri Jan 23, 2009 12:21 am
Dear all,
my problem is the following: I running regressions for 10 countries where the time series named as follows. Country_y, Country_X. Where y is the left side var and x the right side var, country is just the county name. What i want to do now is running a loop in which i´m regressing y on x and some leads and lags of the first difference of x for each country. For model selection a info. criterion is to be minimized. So far, i put the y´s and x´s into a group object and also i have a group object with the first differences of the x-series: grp_y, grp_x and dgrp_x
My code looks roughly as follows where i used different example-codes posted in that forum here (by the way, thanks for that!):
for !i=1 to 10
for %country=grp_y.@seriesname(!i)
equation eq_{%country}
!mininfocrit=??? ' i don´t know what to include here
for !lag=2 to 4
eq_{%counry}.ls grp_y(!i) c grp_x(!i) dgrp_x(!i) 'here i want to include leads and lags but the group index seems not to work with the leads and lags
if eq_{%country}.@aic<!mininfocrit then
!bestlag=!lag
!mininfocrit=eq_{%country}.@aic
endif
next
next
eq_{%country}.ls grp_y(!i) c grp_x(!i) dgrp{%country}(-1 to -!bestlag) dgrp{%country}(1 to !bestlag)
Although it might look confused, hope you somehow get my idea and are able to help me or you can point out a different way to do it. Thanks a lot in advance
my problem is the following: I running regressions for 10 countries where the time series named as follows. Country_y, Country_X. Where y is the left side var and x the right side var, country is just the county name. What i want to do now is running a loop in which i´m regressing y on x and some leads and lags of the first difference of x for each country. For model selection a info. criterion is to be minimized. So far, i put the y´s and x´s into a group object and also i have a group object with the first differences of the x-series: grp_y, grp_x and dgrp_x
My code looks roughly as follows where i used different example-codes posted in that forum here (by the way, thanks for that!):
for !i=1 to 10
for %country=grp_y.@seriesname(!i)
equation eq_{%country}
!mininfocrit=??? ' i don´t know what to include here
for !lag=2 to 4
eq_{%counry}.ls grp_y(!i) c grp_x(!i) dgrp_x(!i) 'here i want to include leads and lags but the group index seems not to work with the leads and lags
if eq_{%country}.@aic<!mininfocrit then
!bestlag=!lag
!mininfocrit=eq_{%country}.@aic
endif
next
next
eq_{%country}.ls grp_y(!i) c grp_x(!i) dgrp{%country}(-1 to -!bestlag) dgrp{%country}(1 to !bestlag)
Although it might look confused, hope you somehow get my idea and are able to help me or you can point out a different way to do it. Thanks a lot in advance