Skip to contents

The make.blocks() helper function generates a suitable blocks argument for the [=mice]{mice} function.

Usage

make.blocks(x, partition = c("scatter", "collect", "void"))

Arguments

x

A data.frame, character vector with variable names, or list with variable names.

partition

A character vector of length 1 used to assign variables to blocks when data is a data.frame. Value "scatter" (default) assigns each variable to it own block. Value "collect" assigns all variables to a single block.

Value

A named list of character vectors with variables names.

Details

Choices "scatter" and "collect" represent to two extreme scenarios for assigning variables to imputation blocks. Use "scatter" to create an imputation model based on fully conditionally specification (FCS). Use "collect" to gather all variables to be imputed by a joint model (JM). Scenario's in-between these two extremes represent hybrid imputation models that combine FCS and JM.

Any variable not listed in will not be imputed. Specification "void" represents the extreme scenario that skips imputation of all variables.

A variable may be a member of multiple blocks. The variable will be re-imputed in each block, so the final imputations for variable will come from the last block that was executed. This scenario may be useful where the same complete background factors appear in multiple imputation blocks.

A variable may appear multiple times within a given block. If a univariate imputation model is applied to such a block, then the variable is re-imputed each time as it appears in the block.

Examples

make.blocks(nhanes)
#> $age
#> [1] "age"
#> 
#> $bmi
#> [1] "bmi"
#> 
#> $hyp
#> [1] "hyp"
#> 
#> $chl
#> [1] "chl"
#> 
make.blocks(c("age", "sex", "edu"))
#> $age
#> [1] "age"
#> 
#> $sex
#> [1] "sex"
#> 
#> $edu
#> [1] "edu"
#>