0

I programmed the "inverse transform sampling" according to its wikipage. It sounds amazing: Given a PDF: $$ p(x) $$ we can generate the samples by $$ s= F^{-1}(r) $$ where $r\in (0,1)$ is a uniform distribution and F(x) denotes the CDF of p(x).

I understand what PDF and CDF are, but I cannot see why the inverse of CDF generates the samples of PDF. Could someone explain it to me?

If I shot a vertical ray to a steep segment of the CDF, and then make a vertical line to x-axis, the value $p(x_0)$ should has a high value. This makes sense because the steep segment is easy to get horizontal shots.

whitegreen
  • 1,583

2 Answers2

1

$P(F^{-1} (U) \leq t) = P(U \leq F(t)) = F(t)$

Where the last equality follows by the cdf of a uniform. Notice that $F(t)$ is the cdf of the random variable you would like to create samples of.

dmh
  • 2,958
0

$F(s)$ is a mapping of the domain of the random variable with that cdf into unit interval.