simCategorical(simPopObj, additional, method = c("multinom", "distribution", "ctree", "cforest"), limit = NULL, censor = NULL, maxit = 500, MaxNWts = 1500, eps = NULL, nr_cpus = NULL, regModel = NULL, seed = 1, verbose = FALSE, by = "strata")simPopObj containing population and household
survey data as well as optionally margins in standardized format.simPopObj that should be
simulated for the population data."multinom" (estimation of the conditional probabilities using
multinomial log-linear models and random draws from the resulting
distributions) or "distribution" (random draws from the observed
conditional distributions of their multivariate realizations).
"ctree" for using Classification trees
"cforest" for using random forestmethod is "multinom", this can be used to
account for structural zeros. If only one additional variable is requested,
a named list of lists should be supplied. The names of the list components
specify the predictor variables for which to limit the possible outcomes of
the response. For each predictor, a list containing the possible outcomes of
the response for each category of the predictor can be supplied. The
probabilities of other outcomes conditional on combinations that contain the
specified categories of the supplied predictors are set to 0. If more than
one additional variable is requested, such a list of lists can be supplied
for each variable as a component of yet another list, with the component
names specifying the respective variables.method is "multinom", this can be used to
account for structural zeros. If only one additional variable is requested,
a named list of lists or data.frames should be supplied. The names of
the list components specify the categories that should be censored. For each
of these categories, a list or data.frame containing levels of the
predictor variables can be supplied. The probability of the specified
categories is set to 0 for the respective predictor levels. If more than one
additional variable is requested, such a list of lists or data.frames
can be supplied for each variable as a component of yet another list, with
the component names specifying the respective variables.NULL (the default). In
the former case and if method is "multinom", estimated
probabilities smaller than this are assumed to result from structural zeros
and are set to exactly 0.simStructure) are used.
simPopObj containing survey
data as well as the simulated population data including the categorical
variables specified by argument additional.
simStructure, simRelation,
simContinuous, simComponents
data(eusilcS) # load sample data
## Not run:
# ## approx. 20 seconds computation time
# inp <- specifyInput(data=eusilcS, hhid="db030", hhsize="hsize", strata="db040", weight="db090")
# ## in the following, nr_cpus are selected automatically
# simPop <- simStructure(data=inp, method="direct", basicHHvars=c("age", "rb090"))
# simPop <- simCategorical(simPop, additional=c("pl030", "pb220a"), method="multinom", nr_cpus=1)
# simPop
# ## End(Not run)
Run the code above in your browser using DataLab