in reply to Skew normally distributed random numbers

What you have to use, in general, is the inverse function of the cumulative distribution of the probability you want to achieve. Start reading right under formula 9.

In less mathematical terms (but only slightly): Assume the chance of x falling between xi and xi+dx is as close to P(xi)*dx as you can get, with dx very small. Then yi = D(xi), with formula 10 connection the two functions — meaning P(x)*dx ≈ D(x+dx)-D(x) for all x, is the chance that x < xi. This chance is between 0 (for xi = -inf) to 1 (for xi = +inf).

Note that Perl's rand function returns an approximately uniform distribution between 0 and 1. Let's say you pick one of these random numbers, use them as the current value for yi, and via the inverse function of D(x) get back a value for xi. Well: those values for x that you get back this way, are distributed with probability function P(x). Et voilą.

So all you need is sub implementing approximately the inverse function for D(x).

  • Comment on Re: Skew normally distributed random numbers