Permutation of all Independent Variables
Posted: Mon Nov 28, 2011 12:14 pm
I have the following variables:
y, x1, x2, x3, x4
They are not a time series. They are an unstructured panel.
I want to run a program that gives me a linear regression with every possible permutation. I want to store R-squared, t-stats, and AIC.
The permutations should include regressions with one-to-many variables. For example I want the results as if I had typed in all of these:
y x1
y x1 x2
y x1 x2 x3
y x1 x2 x3 x4
y x1 x3
y x1 x4
y x2 x3
y x2 x3 x4
y x2 x4
....etc etc.
How do I write a program that will run that regression for me?
y, x1, x2, x3, x4
They are not a time series. They are an unstructured panel.
I want to run a program that gives me a linear regression with every possible permutation. I want to store R-squared, t-stats, and AIC.
The permutations should include regressions with one-to-many variables. For example I want the results as if I had typed in all of these:
y x1
y x1 x2
y x1 x2 x3
y x1 x2 x3 x4
y x1 x3
y x1 x4
y x2 x3
y x2 x3 x4
y x2 x4
....etc etc.
How do I write a program that will run that regression for me?