title: Logistic regression: how to try every combination of predictors in R?
body: <p>This is a duplicate of <a href="https://stats.stackexchange.com/questions/293988/logistic-regression-how-to-try-every-combination-of-predictors">https://stats.stackexchange.com/questions/293988/logistic-regression-how-to-try-every-combination-of-predictors</a>.</p>
  
  <p>I want to perform a logistic regression: I have 1 dependent variable and ~10 predictors.</p>
  
  <p>I want to perform an exhaustive search trying every combination, such as changing order and adding/deleting predictors, etc. For example:</p>
  
  <ul>
  <li><p>y ~ x1 + x2 + x3 + x4 + x5</p></li>
  <li><p>y ~ x2 + x1 + x3 + x4 + x5</p></li>
  <li><p>y ~ x1 + x2 + x3</p></li>
  <li><p>y ~ x5 + x1 + x2 + x3 + x4</p></li>
  <li><p>y ~ x4 + x2</p></li>
  <li><p>...and so on.</p></li>
  </ul>
  
  <p>Computational time is not a stopping issue for me in this case: this is mainly an educational exercise.</p>
  
  <p>Do you know how can I perform it? I use R.</p>
  
  <p><strong>EDIT:</strong> To be clear: this is mainly an educational exercise: I want to test every model so I can sort them all according to some indexes (such as AUC or pseudo-R²) in order to show to my "<em>students</em>" which predictors seem interesting but are not scientifically meaningful. I plan to perform bootstrap resampling to test further the "<em>fishiest</em>" models.</p>