In my case, the data consisted of 8 variables and 500 observations. When I used the leaps()
code, instead of showing the $2^8 - 1$ submodels, the output showed only 10 models corresponding to those n, where $n \choose 2$ > 10. How can I get the entire output?
Asked
Active
Viewed 84 times
1

Thomas
- 43,637
- 12
- 109
- 140
-
1One of the arguments of the function `leaps` is `nbest` with a default `nbest=10`. Have you tried altering this argument? See [help file](http://www.inside-r.org/packages/cran/leaps/docs/leaps). However, I have the impression that you will not get all $2^8-1$ models anyway because `leaps` does not actually run all those regressions. If you ask for more than some 40 best models, it will start taking quite long. – Richard Hardy Mar 24 '15 at 20:16
-
Thank you for your reply, the code worked. – Mar 24 '15 at 20:22
-
Also, check out the function [regsubsets](http://www.inside-r.org/packages/cran/leaps/docs/regsubsets), a wrapper for `leaps` which may be more user-friendly. – Richard Hardy Mar 24 '15 at 20:24
-
Please supply [a reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Thomas Mar 24 '15 at 21:11