Please note that functions with names starting with "mice.impute" are exported to be visible for the mice sampler functions. Please do not call these functions directly unless you know exactly what you are doing.
For continuous variables only.
This function is for RfPred.Emp multiple imputation method, adapter
for mice samplers. In the mice() function, set
method = "rfpred.emp" to call it.
The function performs multiple imputation based on the empirical distribution of out-of-bag prediction errors of random forests.
mice.impute.rfpred.emp(
y,
ry,
x,
wy = NULL,
num.trees.cont = 10,
sym.dist = TRUE,
alpha.emp = 0,
pre.boot = TRUE,
num.threads = NULL,
...
)Vector with imputed data, same type as y, and of length
sum(wy).
Vector to be imputed.
Logical vector of length length(y) indicating the
the subset y[ry] of elements in y to which the imputation
model is fitted. The ry generally distinguishes the observed
(TRUE) and missing values (FALSE) in y.
Numeric design matrix with length(y) rows with predictors for
y. Matrix x may have no missing values.
Logical vector of length length(y). A TRUE value
indicates locations in y for which imputations are created.
Number of trees to build for continuous variables.
The default is num.trees = 10.
If TRUE, the empirical distribution of out-of-bag
prediction errors will be assumed to be symmetric; if FALSE, the
empirical distribution will be kept intact. The default is
sym.dist = TRUE.
This option is invalid when emp.err.cont = FALSE.
The "significance level" for the empirical distribution of
out-of-bag prediction errors, can be used for prevention for outliers
(useful for highly skewed variables).
For example, set alpha = 0.05 to use 95% confidence level.
The default is alpha.emp = 0.0, and the empirical distribution of
out-of-bag prediction errors will be kept intact.
This option is invalid when emp.err.cont = FALSE.
If TRUE, bootstrapping prior to imputation will be
performed to perform 'proper' multiple imputation, for accommodating sampling
variation in estimating population regression parameters
(see Shah et al. 2014).
It should be noted that if TRUE, this option is in effect even if the
number of trees is set to one.
Number of threads for parallel computing. The default is
num.threads = NULL and all the processors available can be used.
Other arguments to pass down.
Number of trees to build. The default is
num.trees = 10.
Shangzhi Hong
RfPred.Emp imputation sampler.
Hong, Shangzhi, et al. "Multiple imputation using chained random forests." Preprint, submitted April 30, 2020. https://arxiv.org/abs/2004.14823.
Zhang, Haozhe, et al. "Random Forest Prediction Intervals." The American Statistician (2019): 1-20.
Shah, Anoop D., et al. "Comparison of random forest and parametric imputation models for imputing missing data using MICE: a CALIBER study." American journal of epidemiology 179.6 (2014): 764-774.
Malley, James D., et al. "Probability machines." Methods of information in medicine 51.01 (2012): 74-81.
# Users can set method = "rfpred.emp" in call to mice to use this method
data("airquality")
impObj <- mice(airquality, method = "rfpred.emp", m = 5,
maxit = 5, maxcor = 1.0, eps = 0,
remove.collinear = FALSE, remove.constant = FALSE,
printFlag = FALSE)
Run the code above in your browser using DataLab