sampfle(sampfling)
sampfle()所属R语言包:sampfling
Random Sampling: the Sampford Algorithm
随机抽样:Sampford算法
译者:生物统计家园网 机器人LoveR
描述----------Description----------
sampfle implements the Sampford algorithm to obtain a sample without replacement and with unequal probabilities. The probability
sampfle实现Sampford算法获得的样本,无需更换和不等概率。的概率
用法----------Usage----------
sampfle(x, size, prob = NULL)
参数----------Arguments----------
参数:x
Either a (numeric, complex, character or logical) vector of more than one element from which to choose, or a positive integer.
无论是(数字的,复杂的,字符或逻辑)的矢量中的一个以上的元素,可以从中选择,或一个正整数。
参数:size
A positive integer giving the number of items to choose.
一个正整数,给出的数字中选择的项目。
参数:prob
A vector of weights for obtaining the elements of the vector being sampled.
一种向量,用于获得被采样的矢量的元素的权重。
Details
详细信息----------Details----------
If x has length 1, sampling takes place from 1:x.
如果x的长度为1,采样发生1:x。
The prob argument gives a vector of weights for obtaining the elements of the vector being sampled. They need not sum to one, but they should be nonnegative and, after normalizing, less than 1/size. The number of nonzero weights must be at least size.
prob参数给出了一个用于获得被采样的矢量的元素的权重向量。他们需要一个总结,但他们应该是非负的,归一化后,不到1/size。非零的权重的数目必须至少size。
The Sampford algorithm draws the first unit i with probability proportional to prob, and subsequent units with probabilities proportional to prob/(1-size*prob[i]) with replacement. As soon as a unit is repeated, the entire sample is rejected and the process is restarted. Thus a sample without replacement is obtained.
Sampford算法绘制第一单元iprob,prob/(1-size*prob[i])与更换成比例的概率和随后的单位比例的概率。只要一个单元重复,将整个样品被拒绝,并且在重新启动的过程。因此无需更换的样品得到的。
The algorithm produces a sample s, subset of x of size n, with probability proportional to
该算法产生的样本s,x大小n“的概率是成正比的子集
值----------Value----------
A vector, which contains the sampled units from x, or indices if x is an integer.
一个向量,其中包含x,或指数的采样单位,如果x是一个整数。
(作者)----------Author(s)----------
Carlos Enrique Carleos Artime <a href="mailto:carleos@vodafone.es.">carleos@vodafone.es.</a>
参考文献----------References----------
Cochran, W.G. (1977) Sampling techniques, John Wiley and Sons.
Sampford, M.R. (1967) On sampling without replacement with unequal probabilities of selection, Biometrika 54:499-513.
参见----------See Also----------
samprop
samprop
实例----------Examples----------
library(sampfling)
sampfle(10, 3, 1:10)
sampfle(c("a","b","c"), 2, c(0.3,0.3,0.4))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|