Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing.

Similar presentations


Presentation on theme: "1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing."— Presentation transcript:

1 1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing from distributions Discrete Discrete Continuous: Direct Continuous: Direct Continuous: Rejection Continuous: Rejection Probability mixing Probability mixing Metropolis method Metropolis method Stratified sampling Stratified sampling

2 2 Law of Large Numbers Theoretical basis of Monte Carlo is the Law of Large Numbers Theoretical basis of Monte Carlo is the Law of Large Numbers LLN: The weighted average value of the function, : LLN: The weighted average value of the function, : This relates the result of a continuous integration with the result of a discrete sampling. All MC comes from this. This relates the result of a continuous integration with the result of a discrete sampling. All MC comes from this.

3 3 Law of Large Numbers (2) At first glance, this looks like this would be useful for mathematicians trying to estimate integrals, but not particularly useful to us— We are not performing integrations we are simulating physical phenomena At first glance, this looks like this would be useful for mathematicians trying to estimate integrals, but not particularly useful to us— We are not performing integrations we are simulating physical phenomena This attitude indicates that you are just not thinking abstractly enough—All Monte Carlo processes are (once you dig down) integrations over a domain of “all possible outcomes” This attitude indicates that you are just not thinking abstractly enough—All Monte Carlo processes are (once you dig down) integrations over a domain of “all possible outcomes” Our values of “x” are over all possible lives that a particle might lead Our values of “x” are over all possible lives that a particle might lead

4 4 Central limit theorem The second most important (i.e., useful) theoretical result for Monte Carlo is the Central Limit Theorem The second most important (i.e., useful) theoretical result for Monte Carlo is the Central Limit Theorem CLT: The sum of a sufficiently large number of independent identically distributed random variables (i.i.d.) becomes normally distributed as N increases CLT: The sum of a sufficiently large number of independent identically distributed random variables (i.i.d.) becomes normally distributed as N increases This is useful for us because we can draw useful conclusions from the results from a large number of samples (e.g., 68.7% within one standard deviation, etc.) This is useful for us because we can draw useful conclusions from the results from a large number of samples (e.g., 68.7% within one standard deviation, etc.) This relates the result of a continuous integration with the result of a discrete sampling. All MC comes from this. This relates the result of a continuous integration with the result of a discrete sampling. All MC comes from this.

5 5 Overview of pdf and cdf Basic definition of probability density function (p.d.f.): Basic definition of probability density function (p.d.f.): And its integral, the cumulative distribution function (c.d.f.): And its integral, the cumulative distribution function (c.d.f.):

6 6 Overview of pdf and cdf (2) Corollaries of these definitions: Corollaries of these definitions:

7 7 Mapping  ->x using p(x) Our basic technique is to use a unique y->x Our basic technique is to use a unique y->x y=  from (0,1) and x from (a,b) y=  from (0,1) and x from (a,b) We are going to use the mapping backwards We are going to use the mapping backwards

8 8 Mapping (2) Note that:  (a)=0  (a)=0  (b)=1  (b)=1 Function is non-decreasing over domain (a,b) Function is non-decreasing over domain (a,b) Our problem reduces to: Finding  (x) Finding  (x) Inverting to get x(  ), a formula for turning pseudo- random numbers into numbers distributed according to desired  (x) Inverting to get x(  ), a formula for turning pseudo- random numbers into numbers distributed according to desired  (x)

9 9 Mapping (3) We must have: We must have:

10 10 Resulting general procedure Form CDF: Form CDF: Set equal to pseudo-random number: Set equal to pseudo-random number: Invert to get formula that translates from  to x: Invert to get formula that translates from  to x:

11 11 Uniform distribution For our first distribution, pick x uniformly in range (a,b): For our first distribution, pick x uniformly in range (a,b): Step 1: Form CDF. Step 1: Form CDF.

12 12 Uniform distribution (2) Step 2: Set pseudo-random number to CDF: Step 2: Set pseudo-random number to CDF: Step 3: Invert to get x(  ): Step 3: Invert to get x(  ): Example: Choose  uniformly in (-1,1): Example: Choose  uniformly in (-1,1):

13 13 Discrete distribution For a discrete distribution, we have N choices of state i, each with probability, so: For a discrete distribution, we have N choices of state i, each with probability, so: Step 1: Form CDF: Step 1: Form CDF:

14 14 Discrete distribution (2) Step 2: Set pseudo-random number to CDF: Step 2: Set pseudo-random number to CDF: Step 3: Invert to get x(  ): Step 3: Invert to get x(  ):

15 15 Discrete distribution (3) Example: Choose among 3 states with relative probabilities of 4, 5, and 6. Example: Choose among 3 states with relative probabilities of 4, 5, and 6.

16 16 Continuous distribution: Direct This fits the “pure” form developed before. This fits the “pure” form developed before. Form CDF: Form CDF: Set equal to pseudo-random number: Set equal to pseudo-random number: Invert to get formula that translates from  to x: Invert to get formula that translates from  to x:

17 17 Continuous: Direct (2) Example: Pick x from: Example: Pick x from:

18 18 Testing your selection There are two simple ways to check a routine that is used to choose from a give distribution: binning or moments There are two simple ways to check a routine that is used to choose from a give distribution: binning or moments Binning involves dividing the domain (or part of it) into (usually equal-sized) regions and then counting what fraction of chosen values fall in the region. Binning involves dividing the domain (or part of it) into (usually equal-sized) regions and then counting what fraction of chosen values fall in the region. The expected answer for a bin that goes from a to b is The expected answer for a bin that goes from a to b is This will be approximately equal to (and close enough for our purposes) the midpoint value times the width: This will be approximately equal to (and close enough for our purposes) the midpoint value times the width: The text notes have a Java routine that will perform a bin testing The text notes have a Java routine that will perform a bin testing KEY to algorithm: Bin that x is in:(Integer part of (x-a)/(b-a)*N) (maybe +1) KEY to algorithm: Bin that x is in:(Integer part of (x-a)/(b-a)*N) (maybe +1)

19 19 Continuous: Rejection Basis of rejection approach: Basis of rejection approach: Usual procedure (using a flat x distribution): 1. Find a value 2. Choose 3. Keep iff Otherwise, return to 1. Otherwise, return to 1.

20 20 Continuous: Rejection (3) Example: Use rejection to pick x from: Example: Use rejection to pick x from:

21 21 Basic idea of probability mixing Situations arise in which you have multiple distributions involved in a single decision: Situations arise in which you have multiple distributions involved in a single decision:

22 22 Probability mixing procedure Real problems do not present themselves so cleanly and you have to figure it out: Real problems do not present themselves so cleanly and you have to figure it out:

23 23 Probability mixing procedure (2) Procedure: 1. Form and normalize the 2. Choose the distribution i using these

24 24 Probability mixing procedure (3) Procedure: 3. Form the p.d.f. for distribution i: 4. Choose using

25 25 Probability mixing procedure (3) Example:Use probability mixing to select x from:

26 26 Metropolis This is a very non-intuitive procedure that falls under the category of Markov chain MC It will ULTIMATELY deliver a consistent series of x’s distributed according to a desired functional form (which does NOT have to be normalized nor do you need to know a maximum value) It has many advantages for certain physical problems in which the relative probability of a chosen point can be determined even if a closed form of the PDF is not available The main disadvantage is that it is very hard to tell when the procedure has “settled in” to the point that the stream of x’s can be trusted to deliver a consistent distribution This method was (supposedly) worked out as part of an after-dinner conversation in Los Alamos after WWII

27 27 Metropolis (2) In its simplest form, the procedure is: In its simplest form, the procedure is: Choose x according to a distribution that has certain properties. We will not go into the details except to say that a uniform distribution has all the properties needed! Choose x according to a distribution that has certain properties. We will not go into the details except to say that a uniform distribution has all the properties needed! Evaluate the PDF at the chosen x Evaluate the PDF at the chosen x Decide whether to use the new point according to these rules: Decide whether to use the new point according to these rules: 1. IF the PDF evaluates higher than the PREVIOUSLY chosen point’s PDF, then use the new x 2. IF the PDF evaluates less than the previous point’s PDF, then pull another random number between 0 and 1 ä If the new random number is LESS than the ratio of (new point’s PDF)/(old point’s PDF), then use the new x ä If the previous test fails, then REUSE the old x

28 28 Stratified sampling This method involves reducing variance by forcing more order onto the random number stream used as input As the simplest example, it can be implemented by FORCING the random number stream to produce EXACTLY half the numbers below 0.5 and half above 0.5 In effect, you are dividing the problem into two subproblems with ½ the width of the domain each This reduces the discrepancy (proportional to the STANDARD DEVIATION) of each to ½ its previous value, which cuts the variance (per history) in half. If time permits, we will work an example in class like the one in the course notes

29 29 “Other”: Two alternate Choose x from Choose x from using: using: Choose x from Choose x from (Gaussian/normal) using: (Gaussian/normal) using: (Why 12?)

30 30 Homework from text

31 31 Homework from text

32 32 Homework from text


Download ppt "1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing."

Similar presentations


Ads by Google