Takes a mids
object, performs maxit
iterations and
produces a new object of class "mids"
.
mice.mids(obj, newdata = NULL, maxit = 1, printFlag = TRUE, ...)
An object of class mids
, typically produces by a previous
call to mice()
or mice.mids()
An optional data.frame
for which multiple imputations
are generated according to the model in obj
.
The number of additional Gibbs sampling iterations. The default is 1.
A Boolean flag. If TRUE
, diagnostic information
during the Gibbs sampling iterations will be written to the command window.
The default is TRUE
.
Named arguments that are passed down to the univariate imputation functions.
mice.mids
returns an object of class "mids"
.
This function enables the user to split up the computations of the Gibbs sampler into smaller parts. This is useful for the following reasons:
To add a few extra iteration to an existing solution.
If RAM memory is exhausted. Returning to prompt/session level may alleviate such problems.
To customize convergence statistics at specific points, e.g.,
after every maxit
iterations to monitor convergence.
The imputation model itself is specified in the mice()
function
and cannot be changed in mice.mids()
. The state of the random
generator is saved with the mids
object. This ensures that the
imputations are reproducible.
imp1 <- mice(nhanes, maxit = 1, seed = 123)
#>
#> iter imp variable
#> 1 1 bmi hyp chl
#> 1 2 bmi hyp chl
#> 1 3 bmi hyp chl
#> 1 4 bmi hyp chl
#> 1 5 bmi hyp chl
imp2 <- mice.mids(imp1)
#>
#> iter imp variable
#> 2 1 bmi hyp chl
#> 2 2 bmi hyp chl
#> 2 3 bmi hyp chl
#> 2 4 bmi hyp chl
#> 2 5 bmi hyp chl
# yields the same result as
imp <- mice(nhanes, maxit = 2, seed = 123)
#>
#> iter imp variable
#> 1 1 bmi hyp chl
#> 1 2 bmi hyp chl
#> 1 3 bmi hyp chl
#> 1 4 bmi hyp chl
#> 1 5 bmi hyp chl
#> 2 1 bmi hyp chl
#> 2 2 bmi hyp chl
#> 2 3 bmi hyp chl
#> 2 4 bmi hyp chl
#> 2 5 bmi hyp chl
# verification
identical(imp$imp, imp2$imp)
#> [1] TRUE
#