I’m trying to create a skewed random number generator using a skew normal distribution, but I don’t know how to turn my formula (which uses
NORMDIST()) into a
NORMINV()-based formula that can generate the numbers I want. This is my formula:
=2/s * NORMDIST((x-m)/s, 0, 1, 0) * NORMSDIST(k*(x-m)/s)
Where “x” is the number, “s” is the scale, “m” is the location, and “k” is the shape. I admit I found the formula online, but it seems to do what I want to do, except the wrong way around.
How can I do this?
Adelchi Azzalini has a page on how to generate pseudo-random numbers with skew-normal (SN) distribution. Here from the page:
The N(0,1) variates u0 and v in step 1. can be calculated in Excel as
NORMINV(RAND(),0,1). And δ expressed in terms of shape parameter α is
δ = α/SQRT(1+α*α).
Note: Python’s SciPy is in the process of getting a skew-normal random variable (
scipy.stats.skewnorm), see here in SciPy 0.18.0rc2 code. The docs reference a paper by Azzalini and Capitanio and the same page I referenced above.