Inverse transform sampling: Difference between revisions

Content deleted Content added
Bender the Bot (talk | contribs)
Line 85:
: The idea is illustrated in the following graph:
 
: [[File:Inverse transformation method for exponential distribution.jpg|thumb|none|400px|Random numbers y<sub>i</sub> are generated from a uniform distribution between 0 and 1, i.e. Y ~ U(0, 1). They are sketched as colored points on the y-axis. Each of the points is mapped according to x=F<sup>−1</sup>(y), which is shown with gray arrows for two example points. In this example, we have used an exponential distribution. Hence, for x ≥ 0, the probability density is <math>\varrho_X(x) = \lambda e^{-\lambda \, x}</math> and the cumulatedcumulative distribution function is <math>F(x) = 1 - e^{-\lambda \, x}</math>. Therefore, <math>x = F^{-1}(y) = - \frac{\ln(1-y)}{\lambda}</math>. We can see that using this method, many points end up close to 0 and only few points end up having high x-values - just as it is expected for an exponential distribution.]]
: Note that the distribution does not change if we start with 1-y instead of y. For computational purposes, it therefore suffices to generate random numbers y in [0, 1] and then simply calculate
: <math>x = F^{-1}(y) = -\frac{1}{\lambda}\ln(y).</math>