View source: R/mice.impute.synthpop.R
mice.impute.synthpop | R Documentation |
The function allows to use a synthpop synthesizing method to be used
in the mice::mice
function of the mice package.
mice.impute.synthpop(y, ry, x, synthpop_fun="norm", synthpop_args=list(),
proper=TRUE, ...)
y |
Incomplete data vector of length |
ry |
Vector of missing data pattern ( |
x |
Matrix ( |
synthpop_fun |
Synthesizing method in the synthpop package |
synthpop_args |
Function arguments of |
proper |
Logical value specifying whether proper synthesis should be conducted. |
... |
Further arguments to be passed |
A vector of length nmis=sum(!ry)
with imputed values.
See syn.mice
for using a mice imputation method in the
synthpop package.
See synthpop::syn
for generating synthetic datasets
with the synthpop package.
## Not run:
#############################################################################
# EXAMPLE 1: Imputation of NHANES data using the 'syn.normrank' method
#############################################################################
library(synthpop)
data(nhanes, package="mice")
dat <- nhanes
#* empty imputation
imp0 <- mice::mice(dat, maxit=0)
method <- imp0$method
#* define synthpop method 'normrank' for variable 'chl'
method["chl"] <- "synthpop"
synthpop_fun <- list( chl="normrank" )
synthpop_args <- list( chl=list(smoothing="density") )
#* conduct imputation
imp <- mice::mice(dat, method=method, m=1, maxit=3, synthpop_fun=synthpop_fun,
synthpop_args=synthpop_args)
summary(imp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.