I have a regression with n different variables.
I would like to try all possible regression combinations.
For example (n=2):
regress yy1
regress yy1 xx1
regress yy1 xx2
regress yy1 xx1 xx2
I would like to try all possible regression combinations in a
convenient way, such that I can
enter the dependent variable and the independent variables.
Then, the program should
(1) find all possible 2^n model combinations,
(2) run each regression, and
(3) store statistics (such as _b, _se, R2).
A convenient way to find all model combinations might be to iterate
from 0 to 2^n-1 and convert the index variable to a binary number.
e.g. n=2:
model=0: 0 0 ==> regress yy1
model=1: 0 1 ==> regress yy1 xx1
model=2: 1 0 ==> regress yy1 xx2
model=3: 1 1 ==> regress yy1 xx1 xx2
Thank you.
Best regards,
Michael
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/