Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Inverse transform sampling
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Examples == * As an example, suppose we have a random variable <math> U \sim \mathrm{Unif}(0,1)</math> and a [[cumulative distribution function]] : <math> \begin{align} F(x)=1-\exp(-\sqrt{x}) \end{align} </math> : In order to perform an inversion we want to solve for <math>F(F^{-1}(u))=u</math> : <math> \begin{align} F(F^{-1}(u))&=u \\ 1-\exp\left(-\sqrt{F^{-1}(u)}\right) &= u \\ F^{-1}(u) &= (-\log(1-u))^2 \\ &= (\log(1-u))^2 \end{align} </math> : From here we would perform steps one, two and three. * As another example, we use the [[exponential distribution]] with <math>F_X(x)=1-e^{-\lambda x}</math> for x β₯ 0 (and 0 otherwise). By solving y=F(x) we obtain the inverse function : <math>x = F^{-1}(y) = -\frac{1}{\lambda}\ln(1-y).</math> :It means that if we draw some <math>y_0</math>from a <math> U \sim \mathrm{Unif}(0,1)</math> and compute <math>x_0 = F_X^{-1}(y_0) = -\frac{1}{\lambda}\ln(1-y_0),</math> This <math>x_0</math> has exponential distribution. : 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 cumulative 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>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)