【发布时间】:2017-05-17 14:16:57
【问题描述】:
总之
我试图更好地理解参数 prob 作为 R 中函数 sample 的一部分。接下来,我会提出一个问题,并提供一段与我的问题相关的 R 代码。
问题
假设我生成了10,000随机标准rnorms。然后我想从这位母亲10,000标准rnorms中抽取size5的样本。
我应该如何在sample 中设置prob 参数,以便从母亲rnorm 中抽取这些5 数字的概率认为母亲rnorm 的中间区域更密集但尾部区域更薄(所以在绘制这 5 个数字时,它会比尾部区域更频繁地从密集区域绘制)?
x = rnorm(1e4)
sample( x = x, size = 5, replace = TRUE, prob = ? ) ## what should be "prob" here?
# OR I leave `prob` to be the default by not using it:
sample( x = x, size = 5, replace = TRUE )
【问题讨论】:
-
因为您是从正态分布中提取的,所以您已经在原始分布的中心有更多的观察值。因此
sample()更有可能返回这些。你想在这里模拟什么情况?您希望得到的分布是什么? -
@MrFlick,你是对的。我想多了。
标签: r statistics sampling resampling