impute | R Documentation |
Perform single or multiple imputation with ARFs. Calls adversarial_rf
,
forde
and expct
/forge
.
impute(
x,
m = 1,
expectation = ifelse(m == 1, TRUE, FALSE),
num_trees = 100L,
min_node_size = 10L,
round = TRUE,
finite_bounds = "local",
epsilon = 1e-14,
verbose = FALSE,
...
)
x |
Input data. |
m |
Number of imputed datasets to generate. The default is single
imputation ( |
expectation |
Return expected value instead of multiple imputations. By
default, for single imputation ( |
num_trees |
Number of trees to grow in the ARF. |
min_node_size |
Minimal number of real data samples in leaf nodes. |
round |
Round continuous variables to their respective maximum precision in the real data set? |
finite_bounds |
Impose finite bounds on all continuous variables? See
|
epsilon |
Slack parameter on empirical bounds; see |
verbose |
Print progress for |
... |
Extra parameters to be passed to |
Imputed data. A single dataset is returned for m = 1
, a list
of datasets for m > 1
.
arf
, forde
, forge
,
expct
, lik
# Generate some missings
iris_na <- iris
for (j in 1:ncol(iris)) {
iris_na[sample(1:nrow(iris), 5), j] <- NA
}
# Single imputation
iris_imputed <- arf::impute(iris_na, num_trees = 10, m = 1)
# Multiple imputation
iris_imputed <- arf::impute(iris_na, num_trees = 10, m = 10)
## Not run:
# Parallelization with doParallel
doParallel::registerDoParallel(cores = 4)
# ... or with doFuture
doFuture::registerDoFuture()
future::plan("multisession", workers = 4)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.