R 绘制更改母样本形状的样本
背景:R 绘制更改母样本形状的样本,r,random,resampling,statistics-bootstrap,R,Random,Resampling,Statistics Bootstrap,背景: 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
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
我正试图修改由使用Initial=rbeta(1e5,2,3)
获得的“Initial”大样本生成的直方图的形状。具体而言,我希望初始大样本的修改版本具有2个额外的较小的(高度)“驼峰”(即,除了初始大样本中存在的一个峰外,还有另外2个较小的高度峰)
编码问题:
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 base中操作sample()
(可能使用它的prob
参数),以便该命令以一种方式进行采样,使两个额外的凸起在X轴上围绕“.5”和”.6”
这是我当前的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
您可以通过将密度分布与beta分布与所需模式相结合来调整密度分布,以实现平滑调整
set.seed(47)
初始值=rbeta(1e5、2、3)
D