Presentation is loading. Please wait.

Presentation is loading. Please wait.

Generating Continuous Random Variables some. Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating.

Similar presentations


Presentation on theme: "Generating Continuous Random Variables some. Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating."— Presentation transcript:

1 Generating Continuous Random Variables some

2 Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating them. These will be the inputs to our Monte Carlo processes. So far, we learned about pseudo-random sequences and a common method for generating them. These will be the inputs to our Monte Carlo processes. Alternate source: Quasi-random numbers Alternate source: Quasi-random numbers –They are not really random, so they have to be used very carefully. –They are not used very much for Monte Carlo methods in radiation transport. But, because they are of such importance to the general field of Monte Carlo (i.e., beyond transport methods), you should have a taste of what they are, how to get and use them. But, because they are of such importance to the general field of Monte Carlo (i.e., beyond transport methods), you should have a taste of what they are, how to get and use them.

3 Quasi-random numbers (2) "Quasi"-random numbers are not random at all; they are a deterministic, equal-division, sequence that are "ordered" in such a way that they can be used by Monte Carlo methods. "Quasi"-random numbers are not random at all; they are a deterministic, equal-division, sequence that are "ordered" in such a way that they can be used by Monte Carlo methods. The easiest to generate are Halton sequences, which are found by "reflecting" the digits of prime base counting integers about their radix point. The easiest to generate are Halton sequences, which are found by "reflecting" the digits of prime base counting integers about their radix point. –You pick a prime number base. –Count in that base. –Reflect the number –Interpret as base 10.

4 Quasi-random numbers (3) After M=Base N -1 numbers in the sequence, the sequence consists of the equally spaced fractions (i/(M+1), i=1,2,3,...M). After M=Base N -1 numbers in the sequence, the sequence consists of the equally spaced fractions (i/(M+1), i=1,2,3,...M). Therefore, the sequence is actually deterministic, not stochastic. (Like a numerical method.) Therefore, the sequence is actually deterministic, not stochastic. (Like a numerical method.) The beauty of the sequence is that the re- ordering results in the an even coverage of the domain (0,1) even if you stop in the middle. The beauty of the sequence is that the re- ordering results in the an even coverage of the domain (0,1) even if you stop in the middle. Because you need ALL of the numbers in the sequence to cover the (0,1) range (which is not true of the pseudo-random sequence), it is important that all of the numbers of the sequence be used on the SAME decision. Because you need ALL of the numbers in the sequence to cover the (0,1) range (which is not true of the pseudo-random sequence), it is important that all of the numbers of the sequence be used on the SAME decision.

5 For a Monte Carlo process that has more than one decision, a different sequence must be used for each decision. (This is why we don’t use them.) For a Monte Carlo process that has more than one decision, a different sequence must be used for each decision. (This is why we don’t use them.) The most common way this situation is handled is to use prime numbers in order— 2,5,7,11,etc.—for decisions. (“Halton” sequence, after UNC professor) The most common way this situation is handled is to use prime numbers in order— 2,5,7,11,etc.—for decisions. (“Halton” sequence, after UNC professor) Asymptotic estimate of error is which means closer to ~ 1/N Asymptotic estimate of error is which means closer to ~ 1/N The resulting standard deviations calculated and printed by standard MC codes are NOT accurate: The resulting standard deviations calculated and printed by standard MC codes are NOT accurate: –Get estimates by “oversetting”

6 Generating Continuous Random Variables some

7 Generating Continuous Random Variables Suppose that X is a continuous random variable with cdf F(x). Furthermore, suppose that you can invert F. Note that if U~unif(0,1), the random variable F -1 (U) has the same distribution as X!

8 Generating Continuous Random Variables Example: To generate exponential rate rv’s: pdf: cdf: Now plug in a uniform!

9 Generating Continuous Random Variables The standard normal distribution: There is no closed form expression for the cdf! normal

10 Generating Continuous Random Variables The Box-Muller Transformation: Let U 1 and U 2 be independent unif(0,1) rv’s. normal Then is normally distributed with mean 0 and variance 1. So is and X 1 and X 2 are independent!

11 Generating Continuous Random Variables Acceptance/Rejection Method: want to simulate a rv X with pdf f need to find another function g so that normalize g to a pdf where

12 want to simulate a rv X with pdf f need to find another function g so that normalize g to a pdf where generate Y with pdf h generate U~unif(0,1) (indep of Y) if U<f(Y)/g(Y), “accept” Y, set X=Y otherwise, “reject” Y, return to

13 Proof: (discrete case)

14 Proof: (continued)

15 So, using this algorithm, Sum both sides over x: What we wanted!

16 Acceptance/Rejection Method Example: Example: Target Density: Try works

17 Acceptance/Rejection Method Example: RESULTS: 100,000 draws Target Density:


Download ppt "Generating Continuous Random Variables some. Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating."

Similar presentations


Ads by Google