mice Imputation Methods — syn_mice" />

Constructs synthetic dataset with mice imputation methods. The functionality is very similar to the functionality of synthpop::syn in the synthpop package (Nowok, Raab, & Dibben, 2016). Methods defined in synthpop are accessible via mice.impute.synthpop (see Examples).

syn_mice(data, m=5, k=NULL, syn_check=TRUE, ...)

Arguments

data

Original data frame

m

Number of synthetic datasets

k

Number of observations in synthetic data

syn_check

Logical indicating whether checks in synthpop::syn should be performed.

...

Further arguments to be passed, with conventions in mice::mice

Value

Object of class synds, see synthpop::syn.

References

Nowok, B., Raab, G., & Dibben, C. (2016). synthpop: Bespoke creation of synthetic data in R. Journal of Statistical Software, 74(11), 1-26. doi: 10.18637/jss.v074.i11

See also

Examples

if (FALSE) {
#############################################################################
# EXAMPLE 1: Synthesization of SD2011 using mice functionality
#############################################################################

library(synthpop)

#** selection of dataset
data(SD2011, package="synthpop")
vars <- c("sex","age","ls","smoke")
dat  <- SD2011[1:1000, vars]
dat$ls <- as.numeric(dat$ls)

#** default synthesis
imp0 <- synthpop::syn(dat)
pred0 <- imp0$predictor.matrix
method0 <- imp0$method

#* define imputation methods
method <- c(sex="synthpop", age="synthpop", ls="synthpop", smoke="logreg")
# only for smoke, an original mice imputation method is used

#- define synthpop functions
synthpop_fun <- list(sex="constant", age="constant", ls="cart")

#- arguments for 'syn.cart' method
synthpop_args <- list(ls=list(smoothing="density"))

#- fixed values for 'syn.constant' method
fixed_values <- dat[,1:2]

#- do synthesization
imp <- miceadds::syn_mice(dat, m=1, synthpop_fun=synthpop_fun, method=method,
            pedictorMatrix=pred0, rf.fixed_values=fixed_values, synthpop_args=synthpop_args)
summary(imp)
}