0

Is there a (calculable) function that given a single, uniformly distributed random value 0 <= x < 1, can "transform" it to a normally distributed value with mean 0 and standard deviation 1?

If there's not an exact function, is there an approximation?

Bohemian
  • 183

2 Answers2

1

If you are concerned by solving for $x$ equation $$\text{erf}(x)=a$$ you could be interested by this post where I proposed as an approximation $$\mathrm{erf}\!\left(x\right)\approx\sqrt{1-\exp\Big(-\frac 4 {\pi}\,\frac{1+\alpha\, x^2}{1+\beta\, x^2}\,x^2 \Big)}$$ where $$\alpha=\frac{10-\pi ^2}{5 (\pi -3) \pi }\qquad \text{and}\qquad \beta=\frac{120-60 \pi +7 \pi ^2}{15 (\pi -3) \pi }$$ which then reduces to solve $$\log(1-a^2)=-\frac 4 {\pi}\,\frac{1+\alpha \,x^2}{1+\beta\, x^2}\,x^2$$ which is a quadratic equation in $x^2$.

For illustration purposes, I give below a few values $$\left( \begin{array}{ccc} a & \text{erf}^{-1}(a) & \text{approx} \\ 0.05 & 0.044340 & 0.044340 \\ 0.10 & 0.088856 & 0.088856 \\ 0.15 & 0.133727 & 0.133727 \\ 0.20 & 0.179143 & 0.179143 \\ 0.25 & 0.225312 & 0.225312 \\ 0.30 & 0.272463 & 0.272463 \\ 0.35 & 0.320858 & 0.320858 \\ 0.40 & 0.370807 & 0.370807 \\ 0.45 & 0.422680 & 0.422681 \\ 0.50 & 0.476936 & 0.476937 \\ 0.55 & 0.534159 & 0.534161 \\ 0.60 & 0.595116 & 0.595120 \\ 0.65 & 0.660854 & 0.660861 \\ 0.70 & 0.732869 & 0.732883 \\ 0.75 & 0.813420 & 0.813449 \\ 0.80 & 0.906194 & 0.906253 \\ 0.85 & 1.017900 & 1.018030 \\ 0.90 & 1.163090 & 1.163390 \\ 0.95 & 1.385900 & 1.386820 \\ 0.96 & 1.452220 & 1.453450 \\ 0.97 & 1.534490 & 1.536190 \\ 0.98 & 1.644980 & 1.647550 \\ 0.99 & 1.821390 & 1.825990 \end{array} \right)$$

  • Maybe you should tell what the error function is and what is the connection of the inverse to the given problem. I am not sure that the OP is versed in these topics... –  Mar 10 '17 at 11:38
  • This is pretty good, but it produces only one side of the bell. Is there a tweak to produce a complete bell, ie as many negative results as positive ones? And @yves is correct, I am not versed in these topics. – Bohemian Mar 10 '17 at 15:18
  • This doesn't seem to work. It produces non-normal dist. Have I got it right: sqrt(1-exp(-1.27323954474*x*x)*(1+0.0586276296*x*x)/(1+0.0886745239*x*x))) ? – Bohemian Mar 11 '17 at 02:52
  • After testing using the code in my previous comment, the values produced are roughly "normalish", but the values are all within 0-1 like a half bell, but I anted a sigma of 1, not a max range of 1. Also the high probability point is at the 1 end, not at zero (although I can deal with the bell being "reversed", so that in itself isn't a problem, just an inconvenience of having to use 1 - f(x) instead) – Bohemian Mar 11 '17 at 09:28
  • @Bohemian. Did you take into account the fact that $\text{erf}(-x)=-\text{erf}(x)$ ? – Claude Leibovici Mar 11 '17 at 09:31
  • @ClaudeLeibovici as per the Q, I don't have any -x, only 0 <= x < 1. I could stretch my random value over -1 < x < 1, but the problem is not that, it's that after 10's of thousands of random numbers, none fall outside the range of 0-1. With a sigma of 1; for a normal dist I expect 68% to be in the range 0-1 – Bohemian Mar 11 '17 at 09:36
0

An easy approximation:

By the central limit theorem, take $n$ random samples, add them, subtract their mean ($\frac n2$) and divide by their standard deviation ($n/\sqrt{12}$) and you get a random variable which approximately follows a normal law. The larger $n$, the better the approximation (but also the cost).

  • Exactly how do I take a single random value in the range 0 to 1 and using it produce a (obviously) single normally distributed value? – Bohemian Mar 10 '17 at 15:14