HTstrata(sampling)
HTstrata()所属R语言包:sampling
The Horvitz-Thompson estimator for a stratified design
霍维茨 - 汤普森估计的分层设计
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes the Horvitz-Thompson estimator of the population total for a stratified design.
计算的的霍维茨-Thompson估计人口总数的分层设计。
用法----------Usage----------
HTstrata(y,pik,strata,description=FALSE)
参数----------Arguments----------
参数:y
vector of the variable of interest; its length is equal to n, the sample size.
感兴趣的变量的矢量,其长度为n,样本大小是相等的。
参数:pik
vector of the first-order inclusion probabilities for the sampled units; its length is equal to n, the sample size.
矢量的一阶夹杂物采样单元的概率,其长度是等于到n,样本大小。
参数:strata
vector of size n, with elements indicating the unit stratum.
矢量的大小为n,表示单位阶层的元素。
参数:description
if TRUE, the estimator is printed for each stratum; by default, FALSE.
如果为true,估计是印刷各阶层,默认情况下,FALSE。
参见----------See Also----------
HTestimator
HTestimator
实例----------Examples----------
# Swiss municipalities data base[瑞士直辖市数据库]
data(swissmunicipalities)
# the variable 'REG' has 7 categories in the population [变量的REG“在人群中,有7个类别,]
# it is used as stratification variable[它是用来作为分层变量]
# computes the population stratum sizes[计算人口阶层大小]
table(swissmunicipalities$REG)
# do not run[不运行]
# 1 2 3 4 5 6 7[1 2 3 4 5 6 7]
# 589 913 321 171 471 186 245[589 913 321 171 471 186 245]
# the sample stratum sizes are given by size=c(30,20,45,15,20,11,44)[样品层尺寸大小= C(30,20,45,15,20,11,44)]
# the method is simple random sampling without replacement [方法很简单随机抽样,无需更换]
# (equal probability, without replacement)[(概率相等,无需更换)]
st=strata(swissmunicipalities,stratanames=c("REG"),size=c(30,20,45,15,20,11,44),
method="srswor")
# extracts the observed data[提取所观察到的数据]
# the order of the columns is different from the order in the initial database[的初始数据库中的列的顺序不同的顺序]
x=getdata(swissmunicipalities, st)
# computes the HT estimator of the variable Pop020 [计算HT估计的变量Pop020]
HTstrata(x$Pop020,x$Prob,x$Stratum,description=TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|