1 Lesson 8: Basic Monte Carlo integration We begin the 2 nd phase of our course: Study of general mathematics of MC We begin the 2 nd phase of our course:

Slides:



Advertisements
Similar presentations
Lectures 6&7: Variance Reduction Techniques
Advertisements

Monte Carlo Methods and Statistical Physics
1 12. Principles of Parameter Estimation The purpose of this lecture is to illustrate the usefulness of the various concepts introduced and studied in.
Sampling Distributions
Measures of Dispersion and Standard Scores
Theoretical Probability Distributions We have talked about the idea of frequency distributions as a way to see what is happening with our data. We have.
Continuous Probability Distributions.  Experiments can lead to continuous responses i.e. values that do not have to be whole numbers. For example: height.
Probability & Statistical Inference Lecture 3
Solving Linear Equations
A Simplifying Framework for an Introductory Statistics Class By Dr. Mark Eakin University of Texas at Arlington.
INTRODUCTORY STATISTICS FOR CRIMINAL JUSTICE
Estimation A major purpose of statistics is to estimate some characteristics of a population. Take a sample from the population under study and Compute.
The standard error of the sample mean and confidence intervals
The standard error of the sample mean and confidence intervals
Point estimation, interval estimation
Maximum likelihood Conditional distribution and likelihood Maximum likelihood estimations Information in the data and likelihood Observed and Fisher’s.
Calculus Review Texas A&M University Dept. of Statistics.
16 MULTIPLE INTEGRALS.
The standard error of the sample mean and confidence intervals How far is the average sample mean from the population mean? In what interval around mu.
Definitions Uniform Distribution is a probability distribution in which the continuous random variable values are spread evenly over the range of possibilities;
1 Stratified sampling This method involves reducing variance by forcing more order onto the random number stream used as input As the simplest example,
Maximum likelihood (ML)
Chapter 5: z-scores.
Component Reliability Analysis
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
© Copyright McGraw-Hill CHAPTER 6 The Normal Distribution.
Simulation of Random Walk How do we investigate this numerically? Choose the step length to be a=1 Use a computer to generate random numbers r i uniformly.
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
01/24/05© 2005 University of Wisconsin Last Time Raytracing and PBRT Structure Radiometric quantities.
ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Double Integrals.
1 Lesson 9: Solution of Integral Equations & Integral Boltzmann Transport Eqn Neumann self-linked equations Neumann self-linked equations Attacking the.
880.P20 Winter 2006 Richard Kass 1 Confidence Intervals and Upper Limits Confidence intervals (CI) are related to confidence limits (CL). To calculate.
STA Lecture 161 STA 291 Lecture 16 Normal distributions: ( mean and SD ) use table or web page. The sampling distribution of and are both (approximately)
1 CSI5388: Functional Elements of Statistics for Machine Learning Part I.
0 Simulation Modeling and Analysis: Input Analysis K. Salah 8 Generating Random Variates Ref: Law & Kelton, Chapter 8.
PROBABILITY & STATISTICAL INFERENCE LECTURE 3 MSc in Computing (Data Analytics)
General Principle of Monte Carlo Fall 2013 By Yaohang Li, Ph.D.
1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
Virtual University of Pakistan Lecture No. 30 Statistics and Probability Miss Saleha Naghmi Habibullah.
Monte Carlo Methods So far we have discussed Monte Carlo methods based on a uniform distribution of random numbers on the interval [0,1] p(x) = 1 0  x.
1 Two Functions of Two Random Variables In the spirit of the previous lecture, let us look at an immediate generalization: Suppose X and Y are two random.
Chapter 5 Parameter estimation. What is sample inference? Distinguish between managerial & financial accounting. Understand how managers can use accounting.
3. Fundamental Theorem of Calculus. Fundamental Theorem of Calculus We’ve learned two different branches of calculus so far: differentiation and integration.
PROBABILITY AND STATISTICS FOR ENGINEERING Hossein Sameti Department of Computer Engineering Sharif University of Technology Principles of Parameter Estimation.
Lesson 4: Computer method overview
1 6. Mean, Variance, Moments and Characteristic Functions For a r.v X, its p.d.f represents complete information about it, and for any Borel set B on the.
PROBABILITY AND STATISTICS FOR ENGINEERING Hossein Sameti Department of Computer Engineering Sharif University of Technology Mean, Variance, Moments and.
Sect. 4.1 Antiderivatives Sect. 4.2 Area Sect. 4.3 Riemann Sums/Definite Integrals Sect. 4.4 FTC and Average Value Sect. 4.5 Integration by Substitution.
Computer simulation Sep. 9, QUIZ 2 Determine whether the following experiments have discrete or continuous out comes A fair die is tossed and the.
1 Introduction to Statistics − Day 4 Glen Cowan Lecture 1 Probability Random variables, probability densities, etc. Lecture 2 Brief catalogue of probability.
1 6. Mean, Variance, Moments and Characteristic Functions For a r.v X, its p.d.f represents complete information about it, and for any Borel set B on the.
Answering Descriptive Questions in Multivariate Research When we are studying more than one variable, we are typically asking one (or more) of the following.
Variability Introduction to Statistics Chapter 4 Jan 22, 2009 Class #4.
Sampling Design and Analysis MTH 494 Lecture-21 Ossam Chohan Assistant Professor CIIT Abbottabad.
R. Kass/W03 P416 Lecture 5 l Suppose we are trying to measure the true value of some quantity (x T ). u We make repeated measurements of this quantity.
Real Zeros of Polynomial Functions
CIVE Engineering Mathematics 2.2 (20 credits) Statistics and Probability Lecture 4 Probability distributions -Poisson (discrete events) -Binomial.
THE NORMAL DISTRIBUTION
Generating Random Variates
Lesson 8: Basic Monte Carlo integration
Virtual University of Pakistan
12. Principles of Parameter Estimation
STAT 206: Chapter 6 Normal Distribution.
Chapter 3 Component Reliability Analysis of Structures.
12. Principles of Parameter Estimation
Lesson 9: Basic Monte Carlo integration
Lesson 4: Application to transport distributions
Generating Random Variates
Presentation transcript:

1 Lesson 8: Basic Monte Carlo integration We begin the 2 nd phase of our course: Study of general mathematics of MC We begin the 2 nd phase of our course: Study of general mathematics of MC Consists of a progression: Consists of a progression: Monte Carlo evaluation of integrals (4 ways) Monte Carlo evaluation of integrals (4 ways) Basic numerical analysis framework (to explain the 4 ways) Basic numerical analysis framework (to explain the 4 ways) MC evaluation of integral equations MC evaluation of integral equations Generalization of this technique to solve general differential equation sets Generalization of this technique to solve general differential equation sets

2 Monte Carlo Integration Next set of mathematical tools: MC integration Next set of mathematical tools: MC integration Our study so far of sampling from distributions has provided us with the tools for MC simulation Our study so far of sampling from distributions has provided us with the tools for MC simulation MC integration will provide: MC integration will provide: More rigorous ideas of keeping score More rigorous ideas of keeping score Basic mathematical underpinnings of variance reduction. Basic mathematical underpinnings of variance reduction. “Abstract” approach to MC problem: ALMOST ALL MC PROBLEMS ARE INTEGRATIONS “Abstract” approach to MC problem: ALMOST ALL MC PROBLEMS ARE INTEGRATIONS Development of four particular methods using the framework. Development of four particular methods using the framework.

3 Four particular integration methods We will now go over four particular variations on this theme: We will now go over four particular variations on this theme: 1. Rejection method 2. Averaging method 3. Control variates method 4. Importance sampling method

4 Rejection method This is a similar approach to the use of rejection methods in picking from a distribution. This is a similar approach to the use of rejection methods in picking from a distribution. It is a "dart board" method in which we estimate the area under a functional curve by containing the curve in a rectangular "box", picking a point randomly in the box, and scoring 0 if it misses (i.e., is above the curve) or the full rectangular area if it hits (i.e., is below the curve). It is a "dart board" method in which we estimate the area under a functional curve by containing the curve in a rectangular "box", picking a point randomly in the box, and scoring 0 if it misses (i.e., is above the curve) or the full rectangular area if it hits (i.e., is below the curve). As before, we have to specify an upper bound of the function,, and then proceed by: As before, we have to specify an upper bound of the function,, and then proceed by:

5 Rejection method (2) 1. Choose a value of uniformly between a and b. 2. Choose a value of uniformly between 0 and 3. Score if and score otherwise. and score otherwise.

6 Rejection method example  Find using a rejection method.  Answer: The maximum value of this function in the range is 4, so our procedure is: 1. Choose a value of uniformly between 0 and Choose a value of uniformly between 0 and Score 8 if is less than ; otherwise score 0.  Find first two moments of this method and calculate the expected mean and SD of mean.

7 Averaging method  This is a much more straight-forward approach to the problem because it uses the function directly. The procedure for this method is to: 1. Choose a value of uniformly between a and b. 2. Score

8 Averaging Example  Again find using an averaging method.  Answer: The procedure is to: 1. Choose a value of uniformly between 0 and Score  Find first two moments of this method and calculate the expected mean and SD of mean. (Compare to previous method.)

9 Control variates method  This method is the first of two methods that utilize a user-supplied second function,, which is chosen to be a "well behaved" approximation to  What makes these methods so powerful is that they allow the user to take use of a priori knowledge about the function.  In the control variates method, the integral solution "begins" as the integral of the known function:  and uses the Monte Carlo approach to find an additive correction to this user-supplied guess.

10 Control variates method (2)  The procedure for this method is to: 1. Choose a value of uniformly between a and b. 2. Score  Notice that there is NO variance introduced through the part of the score.  Obviously, then a good guess will result in a small difference and, therefore a small variance. In the limit of a perfect guess,, there is no correction and no therefore no variance. In the limit of a perfect guess,, there is no correction and no therefore no variance. Not quite as obvious is the fact that if h(x) and f(x) differ by a CONSTANT, we also have a 0 variance method. Not quite as obvious is the fact that if h(x) and f(x) differ by a CONSTANT, we also have a 0 variance method.

11 Control variates example  Again find, this time using a control variates method with  Answer: Note the integral of h(x) over (0,2) is 2. With this value known, the procedure is to: 1. Choose a value of uniformly between 0 and Score  Find first two moments of this method and calculate the expected mean and SD of mean. (Compare to previous methods.)

12 Importance sampling method  The final method is the importance sampling method. This technique is similar to the control variates method, in that it takes advantage of a priori knowledge about the function, but differs from it in that its correction is multiplicative rather than additive.  The importance sampling method uses the approximate function as the probability distribution with which the variables are drawn:

13 Importance sampling (2)  The resulting score is:  As with control variates, a "perfect" guess of would result in a zero variance solution, this time because, again, every score would be exactly correct.  (Note that, because of the normalization, a guess equal to a MULTIPLE of f(x) will also work.)

14 Importance sampling example  Again find, this time using an importance sampling method with Answer: Since the integral of h(x) over the range (0,2) is 2, the resulting probability distribution from which to pick the x’s will be: Following the direct procedure for choosing from this distribution, we first determine the c.d.f, which is:

15 Importance sampling example  We then set this c.d.f. to the uniform deviate: and invert to get the formula: Score is now: Find first two moments of this method and calculate the expected mean and SD of mean. (Compare to previous methods.)Find first two moments of this method and calculate the expected mean and SD of mean. (Compare to previous methods.)

16 2 nd pass at integration: more rigor Theoretical underpinning is the Law of Large Numbers Theoretical underpinning is the Law of Large Numbers In one of our early lectures, we defined the mean of a continuous function as: In one of our early lectures, we defined the mean of a continuous function as: And later worked out a Monte Carlo algorithm with the same expectation: And later worked out a Monte Carlo algorithm with the same expectation:

17 Law of Large Numbers (2) Remember that the Law of Large Number takes this a step further by replacing the x with a function f(x) and speaking of the average value of the function, : Remember that the Law of Large Number takes this a step further by replacing the x with a function f(x) and speaking of the 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.

18 Using the Law of Large Numbers Putting our “goal” integration in this form requires that we multiply and divide by the probability distribution,  (x) Putting our “goal” integration in this form requires that we multiply and divide by the probability distribution,  (x) Following the previous “rules” we have divided the integrand into two “pieces”: the score and the PDF Following the previous “rules” we have divided the integrand into two “pieces”: the score and the PDF There is an implicit requirement that  (x)>0 for all x for which f(x) is not 0 so that f(x)  (x)/  (x) is defined There is an implicit requirement that  (x)>0 for all x for which f(x) is not 0 so that f(x)  (x)/  (x) is defined

19 Dirac notation In our integrations so far, I have simplified the mathematics a bit by always choosing x between a and b. In our integrations so far, I have simplified the mathematics a bit by always choosing x between a and b. I was careful to always choose x between a and b. What if I had not done this? I was careful to always choose x between a and b. What if I had not done this?

20 Dirac notation (2) A more genearl way to approach this (which takes care of the “domain question”) is to look at the Monte Carlo attack of the integral in TWO steps: (1) an approximation of f(x) itself using: (2) a substitution of this functional approximation into the integral:

21 Dirac notation (3) This is the approach we will take from now on. The notation: has the advantage of giving us not only the “weight” but also reminding us of the selected point. This way we can think of a “sample” as having these two pieces: a “weight” and a “location”

22 Averaging method The easiest of our four methods to put in this form is the averaging method (which we previously discussed second) The easiest of our four methods to put in this form is the averaging method (which we previously discussed second) Recall that the procedure for this method is to: Recall that the procedure for this method is to: Choose a value of uniformly between a and b. Choose a value of uniformly between a and b. Score Score In terms of our mathematical framework, this is equivalent to again using: In terms of our mathematical framework, this is equivalent to again using: and scoring with a direct use of and scoring with a direct use of

23 Averaging Example with Dirac  For the third time, find, this time using Dirac approximation  Answer: The Dirac approximation is:

24 Averaging Example with Dirac (2)  If we use:, then we are guaranteed that, giving us: which is equivalent to the averaging method

25 Averaging Example with Dirac (3)  If we use: then plugging in gives us the importance sampling result: then plugging in gives us the importance sampling result:

26 Rejection method Backing up to the rejection method, the procedure was: 1. Choose a value of uniformly between a and b. 2. Choose a value of uniformly between 0 and 3. Score if and score otherwise. and score otherwise. In terms of our mathematical framework, this is equivalent to using: In terms of our mathematical framework, this is equivalent to using: (for a uniform distribution between a and b) and … (for a uniform distribution between a and b) and …

27 Rejection method (2) scoring with a probability mixing strategy of: with probability with probability or scoring or scoring 0 with probability 0 with probability This mixed scoring strategy obviously has the desired expected value of This mixed scoring strategy obviously has the desired expected value of

28 Control variates method  The procedure for this method is to: 1. Choose a value of uniformly between a and b. 2. Score where, h(x) is chosen as an easily integrated approximation of f(x)+constant where, h(x) is chosen as an easily integrated approximation of f(x)+constant

29 Control variates method (2)  In terms of our mathematical framework, this again uses a flat distribution and score with:

30 Importance sampling method  The procedure for this method is to: 1. Choose a value of between a and b using a probability distribution h(x) that is “shaped like” f(x). 2. Score  In terms of our mathematical framework, this is a simple replacement of the flat distribution of the averaging method with the “better” distribution h(x) (with allowance for the fact that h(x) is probably unnormalized):

31 Importance sampling method(2)  Giving us:

32 Solution of Integral Equations Application of our integration techniques to integral equations Introduction of Dirac notation Introduction of Dirac notation Conversion of differential equations to integral equations Conversion of differential equations to integral equations Solution of integral equations Solution of integral equations Solution of linked equations Solution of linked equations

33 Developing integral equations from differential equations: Simple We now know how to attack integrals with Monte Carlo We now know how to attack integrals with Monte Carlo We desire to be able to “solve” differential equations = estimate functionals (usually integrals or point values) of the function that solves a given equation We desire to be able to “solve” differential equations = estimate functionals (usually integrals or point values) of the function that solves a given equation Traditional solution: Convert them into integral equations and apply the MC integration rules to them Traditional solution: Convert them into integral equations and apply the MC integration rules to them Example: Find the value of f(4), given the differential equation and boundary condition: Example: Find the value of f(4), given the differential equation and boundary condition:

34 Simple integral equations (2) Answer: We can integrate from 0 (the known value) to the desired value to get: Answer: We can integrate from 0 (the known value) to the desired value to get: Now we apply one of the four integration methods to the integral in the equation: Now we apply one of the four integration methods to the integral in the equation:

35 Simple integral equations (2) NOTE: From now on, I will skip the summation and division by N and just write the formula for ONE sample: NOTE: From now on, I will skip the summation and division by N and just write the formula for ONE sample:

36 Simple integral equations (3)  The normal procedure for this method is to: 1. Choose a value of between a and b using a probability distribution  (x) (of YOUR choosing). 2. Score  So, let’s do it.  What PDF should we use?  Lazy man’s PDF: uniform  Optimum PDF: ? (You tell me…)

37 Linked equations When you are faced with linked equation sets, the principles are the same, put you have to be more careful: When you are faced with linked equation sets, the principles are the same, put you have to be more careful: Putting in multiple boundary conditions Putting in multiple boundary conditions Keeping up with multiple sampled variables (each equation will have one) Keeping up with multiple sampled variables (each equation will have one) Most tricky: Realizing and adapting to CHANGING LIMITS on the integrals (after the first) Most tricky: Realizing and adapting to CHANGING LIMITS on the integrals (after the first) MUCH more difficult to optimize the choice of the PDFs used MUCH more difficult to optimize the choice of the PDFs used

38 Linked equation example Example: Find f(2) for the second order differential equation: Example: Find f(2) for the second order differential equation: In order to make it fit the category, we will start be re- writing as the linked set: In order to make it fit the category, we will start be re- writing as the linked set:

39 Linked equation example (2) Applying our tools to the second equation first, we begin by transforming it into an integral equation for the value at x=2: Applying our tools to the second equation first, we begin by transforming it into an integral equation for the value at x=2: Using our MC integration approximation, we get: Using our MC integration approximation, we get: How do we get the ? Answer: We estimate it from the other equation. How do we get the ? Answer: We estimate it from the other equation.

40 Linked equation example (3) Applying our tools to the first equation first, we begin by transforming it into an integral equation for the value at Applying our tools to the first equation first, we begin by transforming it into an integral equation for the value at : The resulting procedure is: The resulting procedure is: 1. Choose a value of using 2. Choose a value of using 3. Score:

41 Linked equation example (4) Now let’s do it. Now let’s do it. What PDF’s to use? What PDF’s to use? Flat Flat Better than flat Better than flat

42 HW

43 HW (2)