RRF (version 1.9.1)

rrfImpute: Missing Value Imputations by RRF

Description

Impute missing values in predictor data using proximity from RRF.

Usage

# S3 method for default
rrfImpute(x, y, iter=5, ntree=300, ...)
# S3 method for formula
rrfImpute(x, data, ..., subset)

Arguments

x

A data frame or matrix of predictors, some containing NAs, or a formula.

y

Response vector (NA's not allowed).

data

A data frame containing the predictors and response.

iter

Number of iterations to run the imputation.

ntree

Number of trees to grow in each iteration of RRF.

...

Other arguments to be passed to RRF.

subset

A logical vector indicating which observations to use.

Value

A data frame or matrix containing the completed data matrix, where NAs are imputed using proximity from RRF. The first column contains the response.

Details

The algorithm starts by imputing NAs using na.roughfix. Then RRF is called with the completed data. The proximity matrix from the RRF is used to update the imputation of the NAs. For continuous predictors, the imputed value is the weighted average of the non-missing obervations, where the weights are the proximities. For categorical predictors, the imputed value is the category with the largest average proximity. This process is iterated iter times.

Note: Imputation has not (yet) been implemented for the unsupervised case. Also, Breiman (2003) notes that the OOB estimate of error from RRF tend to be optimistic when run on the data matrix with imputed values.

References

Leo Breiman (2003). Manual for Setting Up, Using, and Understanding Random Forest V4.0. https://www.stat.berkeley.edu/~breiman/Using_random_forests_v4.0.pdf

See Also

na.roughfix.

Examples

Run this code
# NOT RUN {
data(iris)
iris.na <- iris
set.seed(111)
## artificially drop some data values.
for (i in 1:4) iris.na[sample(150, sample(20)), i] <- NA
set.seed(222)
iris.imputed <- rrfImpute(Species ~ ., iris.na)
set.seed(333)
iris.rf <- RRF(Species ~ ., iris.imputed)
print(iris.rf)
# }

Run the code above in your browser using DataCamp Workspace