I'm not entirely sure if this is an answer to your question, but maybe you'll find it useful.
Maybe the author of the randomForest
package would disagree with me, but I feel like the rfImpute()
function is mostly used or called upon other imputation packages in their algorithms to impute many variables. If you only have one variable with missing data, then using this function as a stand alone may work. However, I think it is the case for most people that they have many variables with missing data in a datset that they'd like to impute. Enter the packages missForest
and mice
.
If you use the R package missForest
, you can impute your entire dataset (many variables of different types may be missing) with one command missForest()
. If I recall correctly, this function draws on the rfImpute()
function from the randomForest
package. For some reason (maybe others can elaborate), when you use the missForest()
function, the other variables that are used to predict a single variable can also have missingness. So I think using this function and package are a nice idea if you are hoping to only get one dataset out, after all variables have been imputed.
The downside to using missForest()
is that you only get one dataset, which does not allow you to take into account the uncertainty of your estimates (in your follow-on analytical models). So your analytical models will have incorrect confidence intervals if you just base the analysis on that one imputed dataset. If that doesn't matter to you, then I highly recommend this package and function, because it is very easy to use and specify your imputation model.
However, if you do need to get appropriate confidence intervals and pooled estimates in your analytical models, then you should probably use multivariate imputation by chained equations (MICE) approaches to imputation. For this, you can use the mice
package. There is recent functionality within this package that allows you to specify which variables you'd like to impute with a random forest algorithm, and which you would like to use the usual methods (e.g. pmm). When specifying your imputation model with the mice()
function, under methods you would do something like meth <- c("rfcat", "rfcont")
.
missForest
has a nice vignette you can look up in R.
Here is a nice resource for how to set up your imputation models using mice
:
http://www.stefvanbuuren.nl/publications/MICE%20in%20R%20-%20Draft.pdf