1

I have uniform value in [0,1). I'd like to transform it into a standard normal distribution value, in a deterministic fashion.

What I'm confused about with the Box-Muller transform is that it takes two uniform values in [0, 1), and transform them into two normal random values.

However, I only have one uniform value. How do I apply Box-Muller over a single value?

flag
3 
Anyone interested in this question or related questions, please have a look at the new proposed statistics stack-exchange site. area51.stackexchange.com/proposals/33/… – Noah Snyder Jun 17 2010 at 20:21

4 Answers

5

Use the inverse transform method.

link|flag
1 
And if you need to compute this, the $F_X^{-1}$ that appears there can be simply expressed in terms of the inverse error function. – Nate Eldredge Jun 17 2010 at 22:00
That works, but the inverse CDF is expensive to evaluate. There are much more efficient methods. – John D. Cook Jun 17 2010 at 23:14
3

Hi Joe! It's easy: just use quadratic reciprocity. You haven't forgotten that, have you? :)

Although your setup is in the interval $[0,1)$, I will ignore the left endpoint and work with $(0,1)$. Recall the cumulative distribution function for the normal distribution: $$ \Phi(t) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^t e^{-(1/2)x^2}dx. $$ This function is an increasing map from ${\mathbf R}$ onto $(0,1)$ and its value at $t$ gives the probability that a normal random variable has value less than or equal to $t$. Let $g \colon (0,1) \rightarrow {\mathbf R}$ be its inverse, i.e., $g(x)$ is the unique solution $t$ to $\Phi(t) = x$. That is, $$ \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{g(x)} e^{-(1/2)x^2}dx = x. $$ Note the input to $g$ is a number in $(0,1)$ and the output is a real number. That's the kind of setup you're looking for.

Claim: If $X$ is a uniform random variable on $(0,1)$ then $g(X)$ is a normally distributed random variable on the real line.

Proof: For $a < b$ in ${\mathbf R}$, we want to show the probability $a \leq g(X) \leq b$ is $$ \frac{1}{\sqrt{2\pi}}\int_{a}^b e^{-(1/2)x^2}dx = \Phi(b) - \Phi(a). $$ Since $g$ and $\Phi$ are inverses of each other, the condition $a \leq g(X) \leq b$ is the same as $\Phi(a) \leq X \leq \Phi(b)$, which is a condition in $(0,1)$ and your hypothesis about $X$ being uniform in $(0,1)$ is that the probability of that is $\Phi(b)- \Phi(a)$. Since $$ \Phi(b) - \Phi(a) = \frac{1}{\sqrt{2\pi}}\int_{a}^b e^{-(1/2)x^2}dx, $$ we've got a Gaussian distribution. (That you want $X$ to be uniform made this a lot easier to describe.)

Quite generally, if you want to model a probability distribution on the real line with density function $f(x)$ by sampling a uniform random variable $X$ on $(0,1)$, you can use the function $g(X)$, where $g$ is the inverse of the cumulative distribution function $F(t) = \int_{-\infty}^t f(x)dx$.

link|flag
Gerry's answer suggests a possibly more practical method: take a large number of samples from a uniform distribution on $(0,1)$ and use the central limit theorem, which explains how a standard normal distribution is a limit of a normalized average of independent identically distributed random variables. – KConrad Jun 17 2010 at 23:04
KConrad, someone already gave this answer above (by linkning to a Wikipedia article) and someone else pointed out that it's computationally expensive. – Michael Hardy Jun 18 2010 at 23:58
Michael, I did see that, but (a) I'm not a probabilist and that's my excuse for not knowing what "inverse transform method" meant when I first saw it (once I looked at it later I understood it immediately, of course) and (b) the answer which said this inverse transform method is not so efficient was posted after mine, chronologically. – KConrad Jun 19 2010 at 0:29
2

The Box-Muller method is commonly used. It's simple to implement. And if you need several values, you can use it to produce normal samples two at a time. Otherwise, you could just discard one of the values and pretend you never created it.

George Marsaglia's Ziggurat method is more efficient than Box-Muller but more complicated.

link|flag
1

Given one uniform value in [0,1) you can use alternate digits to get two uniform values. Or alternate bits.

Some other methods to generate standard gaussians are here: http://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution

link|flag

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.