For classification with Random Forests in R, how should one adjust for imbalanced class sizes? I am exploring different classification methods for a project I am working on, and am interested in trying Random Forests. I am trying to educate myself as I go along, and would appreciate any help provided by the CV community.
I have split my data into training/test sets. From experimentation with random forests in R (using the randomForest package), I have been having trouble with a high misclassification rate for my smaller class. I have read this paper concerning the performance of random forests on imbalanced data, and the authors presented two methods with dealing with class imbalance when using random forests.
1. Weighted Random Forests
2. Balanced Random Forests
The R package does not allow weighting of the classes (from the R help forums, I have read  the classwt parameter is not performing properly and is scheduled as a future bug fix), so I am left with option 2. I am able to specify the number of objects sampled from each class for each iteration of the random forest. 
I feel uneasy about setting equal sample sizes for random forests, as I feel like I would be losing too much information about the larger class leading to poor performance with future data. The misclassification rates when downsampling the larger class has shown to improve, but I was wondering if there were other ways to deal with imbalanced class sizes in random forests?
 A: If you don't like those options, have you considered using a boosting method instead? Given an appropriate loss function, boosting automatically recalibrates the weights as it goes along. If the stochastic nature of random forests appeals to you, stochastic gradient boosting builds that in as well. 
A: I think that weighting objects is somehow equivalent to duplicating them. Maybe you should try modifying the bootstrap step by sampling appropriately your different classes.
Another thought is that class imbalance may shift your decision threshold to another value than $0.5$ (if it's a binary classification problem). Try considering ROC curves and AUC to evaluate how bad the imbalance is causing poor performances on your models.
A: The synthetic minority over-sampling (SMOTE) generates new observations of the minority class as random convex combinations of neighboring observations. The paper is here: https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-14-106
A: Instead of sampling large classes you can expand small classes ! If large classes have many times more observation then small, then biase will be small. I do hope you can handle that supersized dataset. 
You may also identify subsets of observations which handle the most information about large classes, there are many possible procedures, the simplest I think is based on nearest neighbors method - observation sampling conditioned on neighborhood graph structure guarantee that sample will have probability density more similar to original one.
randomForest is written in Fortran and c, source code is available (http://cran.r-project.org/src/contrib/randomForest_4.6-2.tar.gz) but I cant spot the place where enthropy is computed,
ps. ups that randomforest use Gini instead of enthropy
A: (1) You're right the weighting function doesn't work and not sure if it has ever been fixed.
(2) Most use option 2 with balanced data. The key to not loosing too much data is stratified sampling. You randomly sample a unique balanced set for each tree. 
