Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random number in a skew normal distribution (equivalent to NORMINV())

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?

like image 544
Wilson Biggs Avatar asked Sep 29 '15 02:09

Wilson Biggs


1 Answers

Adelchi Azzalini has a page on how to generate pseudo-random numbers with skew-normal (SN) distribution. Here from the page:

SN random numbers

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.

like image 87
Ulrich Stern Avatar answered Oct 21 '22 15:10

Ulrich Stern