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
distributing chains evenly among
mids
objects andkeeping the number of chains per object <=
chunk_size
. The resulting number of objects is specified implicitly throughmids$m
andchunk_size
.
Arguments
- mids
A
mids
object, as created bymice::mice()
- chunk_size
The number of to allocate to each smaller
mids
object in the resultinglist
. Ifmids$m %% chunk_size != 0
, a smallerchunk_size
will be used.
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
#>