synthpop Synthesizing Method in the mice Package — mice.impute.synthpop" />

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, ...)

Arguments

y

Incomplete data vector of length n

ry

Vector of missing data pattern (FALSE -- missing, TRUE -- observed)

x

Matrix (n x p) of complete covariates.

synthpop_fun

Synthesizing method in the synthpop package

synthpop_args

Function arguments of syn_fun

proper

Logical value specifying whether proper synthesis should be conducted.

...

Further arguments to be passed

Value

A vector of length nmis=sum(!ry) with imputed values.

See also

See syn.mice for using a mice imputation method in the synthpop package.

See synthpop::syn for generating synthetic datasets with the synthpop package.

Examples

if (FALSE) {
#############################################################################
# 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)
}