title: Excluding an intercept in regsubsets (leaps package)?
body: <p>I am running some model averaging procedures using the output from the regsubsets command from the leaps package. Once I exclude an intercept, I get an error message that I cannot make sense of:</p>
  
  <blockquote>
    <p>Reordering variables and trying again: Error in if
    (any(index[force.out] == -1)) stop("Can't force the same variable in
    and out") :    missing value where TRUE/FALSE needed</p>
  </blockquote>
  
  <p>This problem seems to occur only once my predictor matrix has more columns than the dependent variable has observations (which is one of the reasons for using leaps in the first place). See the example code below: </p>
  
  <pre><code># Load the package --------------------------------------------------------
  require(stats)
  require(leaps)
  
  # Some artificial data ----------------------------------------------------
  y &lt;- rnorm(20)
  x1  &lt;- rnorm(20*20)
  dim(x1) &lt;- c(20,20)
  x2 &lt;- rnorm(20*21)
  dim(x2) &lt;- c(20,21)
  
  # Allow intercept ---------------------------------------------------------
  summary(regsubsets(x1,y))$which
  summary(regsubsets(x2,y))$which
  
  # Without intercept -------------------------------------------------------
  summary(regsubsets(x1,y,intercept=FALSE))$which
  summary(regsubsets(x2,y,intercept=FALSE))$which
  </code></pre>