simComponents(simPopulation)
simComponents()所属R语言包:simPopulation
Simulate components of continuous variables of population data
连续变量的模拟元件的人口数据
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Simulate components of continuous variables of population data by resampling fractions from survey data. The continuous variable to be split and any categorical conditioning variables need to be simulated beforehand.
重采样部分调查数据,人口数据的连续变量的模拟元件。连续变量的分割和任何明确的条件变量需要事先要模拟。
用法----------Usage----------
simComponents(dataS, dataP, w = "rb050", total = "netIncome",
components = c("py010n", "py050n", "py090n",
"py100n", "py110n", "py120n", "py130n", "py140n"),
conditional = c(getCatName(total), "pl030"),
replaceEmpty = c("sequential", "min"), seed)
参数----------Arguments----------
参数:dataS
a data.frame containing household survey data.
data.frame包含家庭调查数据。
参数:dataP
a data.frame containing the simulated population data.
data.frame包含模拟的人口数据。
参数:w
a character string specifying the column of dataS that contains the (personal) sample weights, which are used as probability weights for resampling.
指定dataS的列的字符字符串包含(个人)的样本权重,这是用来作为概率加权重采样。
参数:total
a character string specifying the continuous variable of dataP that should be split into components. Currently, only one variable can be split at a time.
一个字符串指定的连续变量dataP,应分为组件。目前,只有一个变量在同一时间可以被分割。
参数:components
a character vector specifying the components in dataS that should be simulated for the population data.
指定字符向量中的组件dataS,应该是模拟的人口数据。
参数:conditional
an optional character vector specifying categorical contitioning variables for resampling. The fractions occurring in dataS are then drawn from the respective subsets defined by these variables.
一个可选的字符向量指定分类contitioning的变量的重采样。发生的馏分在dataS然后来自这些变量所定义的各自的子集。
参数:replaceEmpty
a character string; if conditional specifies at least two conditioning variables, this determines how replacement cells for empty subsets in the sample are obtained. If "sequential", the conditioning variables are browsed sequentially such that replacement cells have the same value in one conditioning variable and minimum Manhattan distance in the other conditioning variables. If no such cells exist, replacement cells with minimum overall Manhattan distance are selected. The latter is always done if this is "min" or only one conditioning variable is used.
一个字符串;若conditional指定至少两个条件变量,这决定如何得到更换单元样品中的子集为空。如果"sequential",调理变量浏览顺序如更换单元具有相同的值在一个调节变量和最小曼哈顿距离中的其他条件变量。如果不存在这样的单元,替代单元与最低整体曼哈顿距离的选择。后者则是一直在做,如果这是"min"或只有一个调节变量使用。
参数: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 components of the continuous variable specified by total.
Adata.frame包含模拟的人口数据包括连续变量指定的total的组成部分。
注意----------Note----------
The basic household structure, any categorical conditioning variables and the continuous variable to be split need to be simulated beforehand with the functions simStructure, simCategorical and simContinuous.
家庭的基本结构,任何明确的条件变量和连续变量进行分割,需要事先与模拟功能simStructure,simCategorical和simContinuous。
(作者)----------Author(s)----------
Stefan Kraft and Andreas Alfons
参见----------See Also----------
simStructure, simCategorical, simContinuous, simEUSILC
simStructure,simCategorical,simContinuous,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)
basic <- c("age", "rb090", "hsize", "pl030", "pb220a")
eusilcP <- simContinuous(eusilcS, eusilcP,
basic = basic, upper = 200000, equidist = FALSE)
# categorize net income for use as conditioning variable[分类净收入用于作为调节变量]
breaks <- getBreaks(eusilcS$netIncome, eusilcS$rb050,
upper=Inf, equidist = FALSE)
eusilcS$netIncomeCat <- getCat(eusilcS$netIncome, breaks)
eusilcP$netIncomeCat <- getCat(eusilcP$netIncome, breaks)
# simulate net income components[模拟净收入组件]
eusilcP <- simComponents(eusilcS, eusilcP)
summary(eusilcP)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|