dimanche 16 avril 2017

Drawing a sample that changes the shape of the mother sample in R

Background:

I'm trying to modify the shape of a histogram resulted from an "Initial" large sample obtained using Initial = rbeta(1e5, 2, 3). Specifically, I want the modified version of the Initial large sample to have 2 additional smaller (in height) "humps" (i.e., another 2 smaller-height peaks in addition to the one that existed in the Initial large sample).

Coding Question:

I'm wondering how to manipulate sample() in R base so that this command samples in a manner that the two additional humps be around ".5" and ".6" on the X-Axis?

Here is my current R code:

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




Aucun commentaire:

Enregistrer un commentaire