Skip to contents

Combines a list of mids objects into a single mids object. The resulting number of imputed data sets is equal to the sum of the number of imputed data sets in each list element.

Usage

ibindlist(mids_list, call = NULL, seed = NULL, last_seed_value = NULL)

Arguments

mids_list

List of mids objects to combine

call

An optional call to use for the call attribute of the resulting mids object. The default uses the call in mids_list[[1]]$call.

seed

An optional integer to set as the seed attribute of the resulting mids object.

last_seed_value

An optional .Random.seed value to set as the lastSeedValue attribute of the resulting mids object

Value

A combined mids object

Details

The call, seed, and last_seed_value arguments are primarily used by future_mice() and future_mids(); they allow modification of the mids object to match the equivalent mice::mice() output exactly.

Examples

# Create individual `mids` objects
mids1 <- mice::mice(mice::nhanes, m = 1L, maxit = 1L, seed = 1L)
#> 
#>  iter imp variable
#>   1   1  bmi  hyp  chl
mids2 <- mice::mice(mice::nhanes, m = 2L, maxit = 1L, seed = 2L)
#> 
#>  iter imp variable
#>   1   1  bmi  hyp  chl
#>   1   2  bmi  hyp  chl
mids3 <- mice::mice(mice::nhanes, m = 3L, maxit = 1L, seed = 3L)
#> 
#>  iter imp variable
#>   1   1  bmi  hyp  chl
#>   1   2  bmi  hyp  chl
#>   1   3  bmi  hyp  chl

# Combine imputations
mids6 <- ibindlist(list(mids1, mids2, mids3))
mids6
#> Class: mids
#> Number of multiple imputations:  6 
#> Imputation methods:
#>   age   bmi   hyp   chl 
#>    "" "pmm" "pmm" "pmm" 
#> PredictorMatrix:
#>     age bmi hyp chl
#> age   0   1   1   1
#> bmi   1   0   1   1
#> hyp   1   1   0   1
#> chl   1   1   1   0