title: Random Forest with classes that are very unbalanced
body: <p>I am using random forests in a big data problem, which has a very unbalanced response class, so I read the documentation and I found the following parameters:</p>
  
  <pre><code>strata 
  
  sampsize
  </code></pre>
  
  <p>The documentation for these parameters is sparse (or I didn´t have the luck to find it) and I really don´t understand how to implement it. I am using the following code:</p>
  
  <pre><code>randomForest(x=predictors, 
               y=response, 
               data=train.data, 
               mtry=lista.params[1], 
               ntree=lista.params[2], 
               na.action=na.omit, 
               nodesize=lista.params[3], 
               maxnodes=lista.params[4],
               sampsize=c(250000,2000), 
               do.trace=100, 
               importance=TRUE)
  </code></pre>
  
  <p>The response is a class with two possible values, the first one appears more frequently than the second (10000:1 or more)</p>
  
  <p>The <code>list.params</code> is a list with different parameters (duh! I know...)</p>
  
  <p>Well, the question (again) is: How I can use the 'strata' parameter? I am using sampsize correctly?</p>
  
  <p>And finally, sometimes I get the following error:</p>
  
  <pre><code>Error in randomForest.default(x = predictors, y = response, data = train.data,  :
    Still have fewer than two classes in the in-bag sample after 10 attempts.
  </code></pre>
  
  <p>Sorry If I am doing so many (and maybe stupid) questions ...</p>