Performing "all-possible regressions" in R I am trying to implement all-possible regressions in order to select the best predictors of stock returns from an exhaustive list of potential economic/fundamental variables.
My response variable y (i.e. stock returns) is a panel of 3000 securities (cross-section), each having 384 observations (time-series).
Would anyone please suggest the best way to handle this procedure in R, in the context of panel data? I came across the package leaps, but it addresses the case of y as a response vector rather than a response matrix.
Thank you very much,
 A: After re-reading your question, I believe you mean to ask about model selection among your candidate predictor variables, and not actually running all possible regressions. Fitting all possible models from a given set of predictors is subject to a high degree of data-mining bias. Since many such sub-models will be highly correlated with each other (because they include almost entirely the same set of factors) you would need to adjust your t-statistics to account for the probability that, among the entire set of correlated models, some models just randomly look successful within the particular sample data you have. Adjusting for so many models would imply that you'd need an unrealistically high t-statistic to have any confidence in coefficients from the model that you finally select.
Some better approaches might be Bayesian linear regression where you specify what prior distribution you think is realistic for the coefficient on each of the predictors, or regularized regression like Lasso or Ridge, where you impose some penalty term for how dense or big the set of estimated coefficients is (e.g. the fitting procedure will try to favor models with fewer terms in a suitable sense).
If you start out from one of these perspectives, then there is less risk in testing a couple of models that you think have strong prior evidence.
But in general, if you simply look at all n-choose-k subsets of factors, for k = 1 through n, then by simple random chance, some model will appear very strong but not due to actual forecast efficacy. You should avoid this. 
A: I suggest you to use usual panel data analysis approach [in R this involves the use of plm package). There are three categories of explanatory variables (observed or unobserved) that this approach takes into account. First, the variable which is same across each stock but varies over time (economic fundamentals), second is the variable which varies across each stock but doesn't change over the time (e.g., management style), and third includes the variable which varies over time and also across stock (firm's earnings). If the first two variables are unobserved, they are taken into account by using two-way fixed effects (stock effects and year effects), thus use of panel data avoids omitted variable bias arising from the exclusion of these two categories of variables. So, the only bias that arises from the exclusion is due to the omission of last category of variable. If you are sure that your model includes all that belonging to last category, then there is no omitted variable bias. The significance of these variables indicate that they might be important in influencing the stock returns. That being said, which approach to use depends on the purpose of your research. 
