futuremice: Wrapper function that runs MICE in parallel

View source: R/futuremice.R

futuremiceR Documentation

Wrapper function that runs MICE in parallel


This is a wrapper function for mice, using multiple cores to execute 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 m about equally over the cores.


  m = 5,
  parallelseed = NA,
  n.core = NULL,
  seed = NA,
  use.logical = TRUE,
  future.plan = "multisession",



A data frame or matrix containing the incomplete data. Similar to the first argument of mice.


The number of desired imputated datasets. By default $m=5$ as with mice


A scalar to be used to obtain reproducible results over the futures. The default parallelseed = NA will 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 = 1 and if it is desired to obtain the same output as under mice.


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 multisession resolves futures asynchronously (in parallel) in separate R sessions running in the background. See plan for more information on future plans.


Named arguments that are passed down to function mice.


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 Windows systems.

This wrapper function combines the output of future_map with function ibind from the mice package. A mids object is returned and can be used for further analyses.

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. If 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.


A mids object as defined by mids-class


Thom Benjamin Volker, Gerko Vink


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.

See Also

future, furrr, future_map, plan, mice, mids-class


# 150 imputations in dataset nhanes, performed by 3 cores
## Not run: 
imp1 <- futuremice(data = nhanes, m = 150, n.core = 3)
# Making use of arguments in mice.
imp2 <- futuremice(data = nhanes, m = 100, method = "norm.nob")
fit <- with(imp2, lm(bmi ~ hyp))

## End(Not run)

mice documentation built on Nov. 19, 2022, 5:06 p.m.