jomoR/mice.impute.jomoImpute.R
mice.impute.jomoImpute.RdThis function is a wrapper around the jomoImpute function
from the mitml package so that it can be called to
impute blocks of variables in mice. The mitml::jomoImpute
function provides an interface to the jomo package for
multiple imputation of multilevel data
https://CRAN.R-project.org/package=jomo.
Imputations can be generated using type or formula,
which offer different options for model specification.
mice.impute.jomoImpute( data, formula, type, m = 1, silent = TRUE, format = "imputes", ... )
| data | A data frame containing incomplete and auxiliary variables, the cluster indicator variable, and any other variables that should be present in the imputed datasets. |
|---|---|
| formula | A formula specifying the role of each variable
in the imputation model. The basic model is constructed
by |
| type | An integer vector specifying the role of each variable
in the imputation model (see |
| m | The number of imputed data sets to generate. Default is 10. |
| silent | (optional) Logical flag indicating if console output should be suppressed. Default is |
| format | A character vector specifying the type of object that should
be returned. The default is |
| ... | Other named arguments: |
A list of imputations for all incomplete variables in the model,
that can be stored in the the imp component of the mids
object.
The number of imputations m is set to 1, and the function
is called m times so that it fits within the mice
iteration scheme.
This is a multivariate imputation function using a joint model.
Grund S, Luedtke O, Robitzsch A (2016). Multiple
Imputation of Multilevel Missing Data: An Introduction to the R
Package pan. SAGE Open.
Quartagno M and Carpenter JR (2015). Multiple imputation for IPD meta-analysis: allowing for heterogeneity and studies with missing covariates. Statistics in Medicine, 35:2938-2954, 2015.
Other multivariate-2l:
mice.impute.panImpute()
Stef van Buuren, 2018, building on work of Simon Grund,
Alexander Robitzsch and Oliver Luedtke (authors of mitml package)
and Quartagno and Carpenter (authors of jomo package).
# \donttest{ # Note: Requires mitml 0.3-5.7 blocks <- list(c("bmi", "chl", "hyp"), "age") method <- c("jomoImpute", "pmm") ini <- mice(nhanes, blocks = blocks, method = method, maxit = 0) pred <- ini$pred pred["B1", "hyp"] <- -2 imp <- mice(nhanes, blocks = blocks, method = method, pred = pred, maxit = 1)#> #> iter imp variable #> 1 1 bmi chl hyp #> 1 2 bmi chl hyp #> 1 3 bmi chl hyp #> 1 4 bmi chl hyp #> 1 5 bmi chl hyp# }