1 Attachment(s)

Drawing from a semi-log distribution

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!

Attachment 26946

Re: Drawing from a semi-log distribution

Hey aussiedave.

Do you want to sample for an analytic distribution or from an empirical distribution (like the one listed in your graphic)?

Re: Drawing from a semi-log distribution

Quote:

Originally Posted by

**chiro** Hey aussiedave.

Do you want to sample for an analytic distribution or from an empirical distribution (like the one listed in your graphic)?

Hey Chiro,

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.

Re: Drawing from a semi-log distribution

Try look at re-sampling technique code in something like R (which is open source):

R Tutorials--Resampling Techniques