Wrapper function that runs MICE in parallelSource:
This is a wrapper function for
mice, using multiple cores to
mice in parallel. As a result, the imputation
procedure can be sped up, which may be useful in general. By default,
futuremice distributes the number of imputations
about equally over the cores.
futuremice( data, m = 5, parallelseed = NA, n.core = NULL, seed = NA, use.logical = TRUE, future.plan = "multisession", packages = NULL, globals = NULL, ... )
A data frame or matrix containing the incomplete data. Similar to the first argument of
The number of desired imputated datasets. By default $m=5$ as with
A scalar to be used to obtain reproducible results over the futures. The default
parallelseed = NAwill result in a seed value that is randomly drawn between -999999999 and 999999999.
A scalar indicating the number of cores that should be used.
A scalar to be used as the seed value for the mice algorithm within each parallel stream. Please note that the imputations will be the same for all streams and, hence, this should be used if and only if
n.core = 1and if it is desired to obtain the same output as under
A logical indicating whether logical (
TRUE) or physical (
FALSE) CPU's on machine should be used.
A character indicating how
futures are resolved. The default
multisessionresolves futures asynchronously (in parallel) in separate
Rsessions running in the background. See
planfor more information on future plans.
A character vector with additional packages to be used in
mice(e.g., for using external imputation functions).
A character string with additional functions to be exported to each future (e.g., user-written imputation functions).
Named arguments that are passed down to function
A mids object as defined by
This function relies on package
furrr, which is a
package for R versions 3.2.0 and later. We have chosen to use furrr function
future_map to allow the use of
futuremice on Mac, Linux and
A seed value can be specified in the global environment, which will yield
reproducible results. A seed value can also be specified within the
futuremice call, through specifying the argument
parallelseed is not specified, a seed value is
drawn randomly by default, and accessible through
$parallelseed in the
output object. Hence, results will always be reproducible, regardless of
whether the seed is specified in the global environment, or by setting the
same seed within the function (potentially by extracting the seed from the
futuremice output object.
Volker, T.B. and Vink, G. (2022). futuremice: The future starts today. https://www.gerkovink.com/miceVignettes/futuremice/Vignette_futuremice.html
#'Van Buuren, S. (2018). Flexible Imputation of Missing Data. Second Edition. Chapman & Hall/CRC. Boca Raton, FL.