How to do logistic regression subset selection? I am fitting a binomial family glm in R, and I have a whole troupe of explanatory variables, and I need to find the best (R-squared as a measure is fine). Short of writing a script to loop through random different combinations of the explanatory variables and then recording which performs the best, I really don't know what to do. And the leaps function from package leaps does not seem to do logistic regression.
Any help or suggestions would be greatly appreciated.
 A: One idea would be to use a random forest and then use the variable importance measures it outputs to choose your best 8 variables.  Another idea would be to use the "boruta" package to repeat this process a few hundred times to find the 8 variables that are consistently most important to the model.
A: Stepwise and "all subsets" methods are generally bad.  See Stopping Stepwise: Why Stepwise Methods are Bad and what you Should Use by David Cassell and myself (we used SAS, but the lesson applies) or Frank Harrell Regression Modeling Strategies.  If you need an automatic method, I recommend LASSO or LAR.  A LASSO package for logistic regression is available here, another interesting article is on the iterated LASSO for logistic 
A: stats::step function or the more general MASS::stepAIC function supports lm, glm (including logistic regression) and aov family models.
A: First of all $R^2$ is not an appropriate goodness-of-fit measure for logistic regression, take an information criterion $AIC$ or $BIC$, for example, as a good alternative.
Logistic regression is estimated by maximum likelihood method, so leaps is not used directly here. An extension of leaps to glm() functions is the bestglm package (as usually recommendation follows, consult vignettes there).
You may be also interested in the article by David W. Hosmer, Borko Jovanovic and Stanley Lemeshow Best Subsets Logistic Regression // Biometrics Vol. 45, No. 4 (Dec., 1989), pp. 1265-1270 (usually accessible through the university networks).
