Do you want to sample for an analytic distribution or from an empirical distribution (like the one listed in your graphic)?
Hello all. I have a paper that gives the number of binary stars as a function of period. The period is given in a log scale. I want to create at random a list of binary stars, with their period coming from this distribution. The problem is, I am not sure quite how to do this properly with a log distribution. What I currently do is choose at random, based on the cumulative probability, one of the edges of the histogram. I then the actual period is calculated from a uniform random distribution between this edge and the next edge to the left. I always figured this would be an approximation, but it is really scewing the distribution I draw. Can someone please give me some advice? I have attached images of the distribution taken from the paper, a Matlab plot of it (so basically the same thing) and then a histogram of the distribution I draw, which you can see is skewed. Note that the data was taken off the histogram by eye.
Thank you in advance!
I want to sample from an empirical distribution. As you can see by comparing the right plot to the other two, I am drawing something that is somewhat similar but just a bit scewed. This is drawn over 10,000 binary stars so the number of statistics is pretty good. Repeated attempts all give me the same approximate result.