【发布时间】:2017-09-12 09:45:20
【问题描述】:
背景:
我正在尝试修改使用Initial = rbeta(1e5, 2, 3) 获得的“初始”大样本生成的直方图形状。具体来说,我希望初始大样本的修改版本有 2 个额外的较小(高度)“驼峰”(即,除了另外 2 个较小高度的峰存在于初始大样本中的那个)。
编码问题:
我想知道如何在 R 基础中操作 sample()(可能使用它的 prob 参数),以便此命令以另外两个 驼峰 围绕 的方式进行采样".5" 和 ".6" 在 X 轴上?
这是我当前的 R 代码:
Initial = rbeta(1e5, 2, 3) ## My initial Large Sample
hist (Initial) ## As seen, here there is only one "hump" say near
# less than ".4" on the X-Axis
Modified.Initial = sample(Initial, 1e4 ) ## This is meant to be the modified version of the
# the Initial with two additional "humps"
hist(Modified.Initial) ## Here, I need to see two additional "humps" near
# ".5" and ".6" on the X-Axis
【问题讨论】:
标签: r random resampling statistics-bootstrap