Skip to contents

isplit() is the inverse of ibindlist() and converts a single mids object into a list of mids objects containing the largest number of chains possible while

  1. distributing chains evenly among mids objects and

  2. keeping the number of chains per object <= chunk_size. The resulting number of objects is specified implicitly through mids$m and chunk_size.

Usage

isplit(mids, chunk_size = 1L)

Arguments

mids

A mids object, as created by mice::mice()

chunk_size

The number of to allocate to each smaller mids object in the resulting list. If mids$m %% chunk_size != 0, a smaller chunk_size will be used.

Value

A list of mids objects

Examples

# Create `mids` object
mids <- mice::mice(mice::nhanes, m = 2L, maxit = 1L)
#> 
#>  iter imp variable
#>   1   1  bmi  hyp  chl
#>   1   2  bmi  hyp  chl

# Split into two - 1 imputation per object
mids_list <- isplit(mids)
mids_list
#> [[1]]
#> Class: mids
#> Number of multiple imputations:  1 
#> 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
#> 
#> [[2]]
#> Class: mids
#> Number of multiple imputations:  1 
#> 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
#>