if (FALSE) {
#############################################################################
# EXAMPLE 1: Generate synthetic data with item responses and covariates
#############################################################################
data(data.ma09, package="miceadds")
dat <- data.ma09
# fixed variables in synthesis
fix_vars <- c("PV1MATH", "SEX","AGE")
# ordinal variables in synthesis
ord_vars <- c("FISCED", "MISCED", items)
# variables that should be synthesized
syn_vars <- c("HISEI", "FISCED", "MISCED", items)
#-- synthesize data
mod <- miceadds::syn_da( dat=dat0, syn_vars=syn_vars, fix_vars=fix_vars,
ord_vars=ord_vars, da_noise=0.5, imp_maxit=2, use_pls=TRUE, ncomp=20,
exact_regression=TRUE, exact_marginal=TRUE)
#- extract synthetic dataset
mod$dat_syn
}
Run the code above in your browser using DataLab