title: Error when imputing low-variance observations with mice
body: <p>I'm working with a few datasets that have missing values, which should be predictable based on other complete observations in the datasets. I would like to impute these using multiple imputation with the mice package. Many of the data values are very small (E-3 or -4).</p>
  <p>The behavior of mice has been a bit odd. When there are observations with many values of low variance, say, ~300 observations of roughly 50 variables, I receive errors using the &quot;rf&quot; or &quot;midastouch&quot; methods. The other methods work fine. If I increase the variance of the observations the errors disappear.</p>
  <pre><code>library(mice)
  
  #simulate the dataset
  sim &lt;- matrix(data = rnorm(14500, sd=0.01), nrow=290)
  
  #randomly select 20% of rows to have some missing data to replicate the pattern of NAs in the real datasets
  r &lt;- sample(1:nrow(sim), nrow(sim)*0.2)
  
  #for each selected row, randomly set 6 of the 50 variables to NA.
  for(i in r){
    sim[i, sample(50, 6)] &lt;- NA
  }
  
  mice(sim, method='rf')
  </code></pre>
  <p>This returns:</p>
  <pre><code>Error in randomForest.default(x = xobs, y = yobs, ntree = 1, ...) : 
    NAs in foreign function call (arg 11)
  In addition: Warning messages:
  1: In randomForest.default(x = xobs, y = yobs, ntree = 1, ...) :
    invalid mtry: reset to within valid range
  2: In max(ncat) : no non-missing arguments to max; returning -Inf
  3: In randomForest.default(x = xobs, y = yobs, ntree = 1, ...) :
    NAs introduced by coercion to integer range
  </code></pre>
  <p>And using <code>mice(sim, method='midastouch')</code>:</p>
  <pre><code>Error in base::rbind(...) : 
    number of columns of matrices must match (see arg 2)
  </code></pre>
  <p>If we use a different method, or increase the variance of the observations, no problem:</p>
  <pre><code>mice(sim, method='norm')
  
  sim &lt;- sim*10
  mice(sim, method='rf')
  mice(sim, method='midastouch')
  </code></pre>
  <p>I initially thought that the low variance must cause an issue with randomForest, yet 'midastouch' also fails, albeit with a different error. I've tried searching the issue, debugging in R, and searching through the mice and randomForest code, but I can't figure out why these errors might occur. Any help would be appreciated.</p>
  <p>I'm performing multiple imputation.</p>