5

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?

user603
  • 21,225
  • 3
  • 71
  • 135
James Mitch
  • 153
  • 1
  • 5

1 Answers1

6

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.

Dilip Sarwate
  • 41,202
  • 4
  • 94
  • 200
  • 3
    (+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. – cardinal Jan 10 '13 at 02:20
  • @cardinal Nice point! And if the RNG has both $0$ and $1$ as possible valid outputs, then some re-programming might be necessary... – Dilip Sarwate Jan 10 '13 at 02:30