selectSample(SamplingStrata)
selectSample()所属R语言包:SamplingStrata
Selection of a stratified sample from the frame with srswor method
选择一个分层抽样从srswor方法的框架
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Once optimal stratification has been obtained ('outstrata'),and a new frame has been built by assigning to the units of the old one the new stratum labels (by means of "updateFrame" function, it is possible to select a stratified sample from the frame with the srswor method. The result of the execution of "selectSample" function is a dataframe containing selected units, with the probabilities of inclusion. It is possible to output this dataframe in a .csv file. One more .csv file is produced ("sampling check"), containing coeherence checks between (a) population in frame strata (b) population in optimised strata (c) planned units to be selected in optimised strata (d) actually selected units (e) sum of weights in each stratum
一旦得到最佳分层(outstrata),并且已经建立了一个新的数据框分配给旧的一个新的阶层标签(由“updateFrame”功能的装置的单位,它是可以选择一个分层样本从帧的srswor方法的执行“selectSample”功能的结果是一个数据框包含选定的单位,列入的概率,这是可能的。csv文件输出该数据框。更多。csv文件生产(“抽样检查”),含有coeherence检查帧阶层之间的(a)人口(b)人口在优化阶层(三)计划的单位可以选择在优化阶层(四)实际选择单元(e)的总和在每一层的权重
用法----------Usage----------
selectSample(frame, outstrata, writeFile = "YES")
参数----------Arguments----------
参数:frame
This is the (mandatory) dataframe containing the sampling frame, as it has been modified by the execution of the "updateFrame" function. Name of stratum variable must be 'strato'.
这是(强制)包含的采样帧的数据框,因为它已被改性的“updateFrame”功能的执行。阶层变量的名称必须是“平流层”。
参数:outstrata
This is the (mandatory) dataframe containing the information related to resulting stratification obtained by the execution of "optimizeStrata" function. Name of stratum variable must be 'strato'.
这是一个包含相关的信息,以通过以下方式获得“optimizeStrata”功能的执行产生分层的数据框(强制)。阶层变量的名称必须是“平流层”。
参数:writeFile
Indicates if at the end of the processing the resulting strata will be outputted in a delimited file. Default is "YES".
表示如果在处理结束,将输出在产生的地层带分隔符的文件。默认值是“YES”。
值----------Value----------
A dataframe containing the sample
一个数据框包含的样本
(作者)----------Author(s)----------
Giulio Barcaroli, Diego Zardetto
实例----------Examples----------
#[]
# The following example is realistic, but is time consuming[下面的例子是现实的,但耗时]
#[]
## Not run: [#不运行:]
library(SamplingStrata)
data(swisserrors)
data(swissstrata)
# optimisation of sampling strata[优化采样阶层的]
outstrata <- optimizeStrata (
errors = swisserrors,
strata = swissstrata,
cens = NULL,
strcens = FALSE,
initialStrata = 3000,
addStrataFactor = 0.01,
minnumstr = 2,
iter = 60,
pops = 20,
mut_chance = 0.05,
elitism_rate = 0.2,
highvalue = 100000000,
suggestions = NULL,
writeFile = "YES")
# updating sampling strata with new strata labels[更新采样地层的新的阶层标签]
newstrata <- updateStrata(swissstrata)
# updating sampling frame with new strata labels[更新新的阶层标签的抽样框]
data(swissframe)
framenew <- updateFrame(frame=swissframe,newstrata=newstrata)
# selection of sample[选择的样本]
sample <- selectSample(frame = framenew, outstrata = outstrata, writeFile="YES")
head(sample)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|