8
$\begingroup$

I only have a uniform distribution function between [0,1]. And from this distribution, I should generate a sequence of Rayleigh distributed random variable using some software.

Anyhow, I was able to finish the problem using the formula from the Wikipedia article:

$$(1)\;\;\;\;X=\sigma\sqrt{-2\ln(U)}$$

However, there is only one thing I could not understand. I tried many times to derive formula $(1)$ using the Inverse transform sampling method, but I could not.

Can someone show me the steps of how $(1)$ is found?

$\endgroup$

1 Answer 1

9
$\begingroup$

If random variable $X$ has CDF $F(x)$, then $F^{-1}(U)$ is a sample of $X$ where $U$ is uniformly distributed on the unit interval. This is a standard result in probability theory, and I assume that you do not need a proof of this.

The CDF of a Rayleigh random variable $X$ is $$F(x) = 1 - \exp\left(-\frac{x^2}{2\sigma^2}\right), ~~x \geq 0,$$ and so $F^{-1}(y) = \sigma\sqrt{-2\ln(1-y)}$. But, since $1-U$ is also uniformly distributed on the unit interval, we save one subtraction by using $X = \sigma\sqrt{-2\ln( U})$ instead.

$\endgroup$
2
  • 4
    $\begingroup$ (+1) Important aside: Make sure you know how your random number generator works before saving the subtraction. Some RNGs will have zero as a valid output while others won't. The consequences could be severe. Likewise some RNGs may admit one as a valid output. $\endgroup$
    – cardinal
    Commented Jan 10, 2013 at 2:20
  • 1
    $\begingroup$ @cardinal Nice point! And if the RNG has both $0$ and $1$ as possible valid outputs, then some re-programming might be necessary... $\endgroup$ Commented Jan 10, 2013 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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