Page 1 of 1

Finding the correct combination of lags for forecasting

Posted: Tue Jun 21, 2011 10:52 am
by marcounam
Hello:

I have the following problem:

I have two series of dependent variables and nine series of independent variables. I need to do the following: For each series of dependent variables find the best ten equations of (any)five series of the nine independent variables where each series of independent variables can have a lag of up to 3 years. The major problem i have is that i would like some type of "for loop" that would do the following : "for every possible sub-group of 5 independent series out of the nine possible independent series" run the regressions over all possible combination of lags. I have code that given a sub-group of five independent series runs the regressions over all possible combinations of lags of these 5 series. What i dont have is code that loops through all the sub-groups of five series out of the nine possible series. Could this be done?

Many Thanks for your time.

Re: Finding the correct combination of lags for forecasting

Posted: Tue Jun 21, 2011 10:56 am
by EViews Gareth
Not quite sure I understand the question. Yes, it is possible to write a for loop that loops through your variables, building groups of 5. It seems to me it would be quite similar to the loop you've already written that does the lag combinations.

Re: Finding the correct combination of lags for forecasting

Posted: Tue Jun 21, 2011 11:09 am
by marcounam
OK. I found a way to build all possible combinations of 5 series out of 22 series(i actually have 22 series of independent variables). Now the problem is that binomial coefficient (22,5) is greater 26,000, so how do i implement this for loop? do i put all the (22,5) groups in a for loop? or is there a way to do sometinhg along the lines of : "for !i=1 to (22,5)": read the subset of five variables from some database and run the regression for that subset?

Thanks for your time!
P.S I edited this post

Re: Finding the correct combination of lags for forecasting

Posted: Tue Jun 21, 2011 11:50 am
by EViews Gareth
No.