3.2.1 Sampling via Inversion of the cdf



next up previous
Next: 3.3 More on Sampling Up: 3.2 Transformation of pdf's Previous: 3.2 Transformation of pdf's

3.2.1 Sampling via Inversion of the cdf

Since the r.v. and the cdf are 1-to-1, one can sample by first sampling and then solving for by inverting , or . But Eq. (83) tells us that the cdf is uniformly distributed on [0,1], which is denoted . Therefore, we simply use a random number generator (RNG) that generates numbers, to generate a sample from the cdf . Then the value of is determined by inversion, . This is depicted graphically in Figure 12. The inversion is not always possible, but in many important cases the inverse is readily obtained.


Figure 12 Sampling Using the Inverse of the cdf View figure

This simple yet elegant sampling rule was first suggested by von Neumann in a letter to Ulam in 1947 [Los Alamos Science, p. 135, June 1987]. It is sometimes called the ``Golden Rule for Sampling''. Since so much use will be made of this result throughout this chapter, we summarize below the steps for sampling by inversion of the cdf:

Step 1.
Sample a random number from
Step 2.
Equate with the cdf:
Step 3.
Invert the cdf and solve for :


Let the r.v. be uniformly distributed between and . In this case, the cdf is easily found to be

 

Now sample a random number from , set it equal to , and solve for :

 

which yields a sampled point that is uniformly distributed on the interval .


Consider the penetration of neutrons in a shield, where the pdf for the distance to collision is described by the exponential distribution,

A distance to collision is then determined by first sampling a value for the cdf from and solving for . One does not need to subtract the random number from unity, because and are both uniformly distributed on [0,1], and statistically the results will be identical.




next up previous
Next: 3.3 More on Sampling Up: 3.2 Transformation of pdf's Previous: 3.2 Transformation of pdf's



verena@csep1.phy.ornl.gov