Analytics

19 March 2015

Sampling from the uniform and the inverse transform

Following Exercise 2.2. from Introducing Monte Carlo Methods with R by Robert & Casella.

Given

$$u = F(x) = \frac{1}{1 + e^{\frac{-(x-\mu)}{\beta}}},$$

we rearrange for $x$,

$$ x = F^{-1}(u) = \mu - \beta \ln(1/u - 1),$$

with $u \sim U(0, 1)$.

Both sampling from $u$ and applying the inverse function and sampling from the logistic distribution yield similar results.

We visualise the similarity,



Neato!

No comments:

Post a Comment