-3

I tried to produce data in R that is distributed like on this image:

enter image description here

The values should really lie only between -1 and +1 but less should be between -1 and 0 compared to 0 and +1.

user969113
  • 2,349
  • 10
  • 44
  • 51
  • Well, I tried playing around with the rnorm function setting different parameters and then merging the data together but never really looked like on that image :/ – user969113 Feb 14 '13 at 17:19
  • 2
    See for example [this](http://stackoverflow.com/questions/11530010/how-to-simulate-bimodal-distribution-in-r/11530222) question. – Julius Vainora Feb 14 '13 at 17:20
  • Thanks Julius. that solved my problem. That was actually what I was looking for. great! – user969113 Feb 14 '13 at 17:28

1 Answers1

-1

You need do this:

1) Discover a function that have this shape (like (-(x-1)x^2(x+1)*(x+2))*k) 2) Integrate it in the interval -1 to 1 (it will be a function of k) 3) Match this integration to 1 (to discover K) 4) Sample a number between 0 and 1 (let's call this number z) 5) Discover y that the integrate of you function from 0 to y give z 6) Repeat tons of time steps 4-5

Rcoster
  • 3,170
  • 2
  • 16
  • 35