simCategorical(simPopulation)
simCategorical()所属R语言包:simPopulation
Simulate categorical variables of population data
模拟分类变量的人口数据
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Simulate categorical variables of population data. The household structure of the population data needs to be simulated beforehand.
模拟分类变量的人口数据。家庭结构,人口数据,需要事先要模拟的。
用法----------Usage----------
simCategorical(dataS, dataP, w = "rb050", strata = "db040",
basic, additional = c("pl030", "pb220a"),
method = c("multinom", "distribution"),
limit = NULL, censor = NULL, maxit = 500,
MaxNWts = 1500, eps = NULL, seed)
参数----------Arguments----------
参数:dataS
a data.frame containing household survey data.
data.frame包含家庭调查数据。
参数:dataP
a data.frame containing the simulated population household structure.
data.frame包含的模拟人口家庭结构。
参数:w
a character string specifying the column of dataS that contains the (personal) sample weights.
指定列的dataS,包含一个字符串(个人)样本权重。
参数:strata
a character string specifying the columns of dataS and dataP, respectively, that define strata. The values are simulated for each stratum separately. Note that this is currently a required argument and only one stratification variable is supported.
一个字符串指定的列dataS和dataP,分别确定地层。各阶层分别是模拟的值。请注意,这是目前一个必要的参数,并支持只有一个分层变量。
参数:basic
a character vector specifying the columns of dataS and dataP, respectively, that define the household structure, typically age, gender and household size. The default value is c("age", "rb090", "hsize") if method is "multinom", and c("age", "rb090") if method is "distribution".
字符向量指定列的dataS和dataP,分别定义家庭结构,典型的年龄,性别和家庭的大小。默认值是c("age", "rb090", "hsize")如果method是"multinom"和c("age", "rb090")如果method是"distribution"。
参数:additional
a character vector specifying additional categorical variables of dataS that should be simulated for the population data.
一个字符向量确定的其他分类变量的dataS应该是模拟的人口数据。
参数:method
a character string specifying the method to be used for simulating the additional categorical variables. Accepted values are "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).
一个字符的字符串指定的方法被用于模拟附加的分类变量。可接受的值是"multinom"(使用多项对数线性模型和随机条件概率的估计吸引了来自产生的分布),或"distribution"(,随机从所观察到的条件分布的多元实现)。
参数:limit
if method 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如果是"multinom",这可以用来解释结构零。如果要求只有一个额外的变量,一个名为列表的列表,应提供。列表组件的名称指定预测变量的限制可能的结果的反应。对于每一个预测,可以提供一个列表,其中包含每个类别的预测可能的结果的反应。条件的组合,包含指定的类别所提供的预测变量的其他结果的概率被设置为0。如果一个以上的附加变量被请求时,这样的列表的列表可以被提供为每个变量作为又一列表的一个组件,与组件名称指定相应的变量。
参数:censor
if 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.
method如果是"multinom",这可以用来解释结构零。如果只有一个要求额外的变量,命名列表,列表或data.frame的,应提供。列表组件的名称指定的类别,应审查。对于每个类别,列表或data.frame可以提供包含预测变量的水平。指定类别的概率被设置为0的各自的预测水平。如果一个以上的附加变量被请求时,这样的列表的列表或data.frames可以为每个变量供给与组件名称指定相应的变量的又一列表,作为一个组件。
参数:maxit, MaxNWts
control parameters to be passed to multinom and nnet. See the help file for nnet.
控制参数被传递到multinom和nnet。请参阅帮助文件nnet。
参数:eps
a small positive numeric value, or 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.
一个小的正数值,或NULL(默认值)。在前者的情况下,如果method被"multinom",估计概率小于该假定导致从结构零,被设置为恰好为0。
参数:seed
optional; an integer value to be used as the seed of the random number generator, or an integer vector containing the state of the random number generator to be restored.
可选的,一个整数的值被用作种子的随机数发生器,或一个整数矢量包含随机数发生器的状态,以被恢复。
值----------Value----------
A data.frame containing the simulated population data including the categorical variables specified by additional.
Adata.frame模拟的人口数据,包括分类变量指定的additional。
注意----------Note----------
The basic household structure needs to be simulated beforehand with the function simStructure.
家庭结构的基本需要事先要模拟的功能simStructure。
Parts of the function were re-implemented with package version 0.3. For the method based on multinomial log-linear models, the function is now much more memory-efficient and faster if there is a large number of possible combinations in the categorical predictor variables. Nevertheless, results may be different from previous versions of the package.
各部分的功能包0.3版重新实现。基于多项式的对数线性模型的方法,现在更多的内存效率和更快的功能是,如果有一个大的分类预测变量可能的组合数。然而,结果可能会有所不同从以前版本的软件包。
(作者)----------Author(s)----------
Andreas Alfons and Stefan Kraft
参见----------See Also----------
simStructure, simRelation, simContinuous, simComponents, simEUSILC
simStructure,simRelation,simContinuous,simComponents,simEUSILC
实例----------Examples----------
## Not run: [#不运行:]
## these take some time and are not run automatically[#这需要一定的时间,并没有自动运行]
## copy & paste to the R command line[#复制和粘贴到R命令行]
set.seed(1234) # for reproducibility[可重复性]
data(eusilcS) # load sample data[加载示例数据]
eusilcP <- simStructure(eusilcS)
eusilcP <- simCategorical(eusilcS, eusilcP)
summary(eusilcP)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|