Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico

Size: px
Start display at page:

Download "Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico"

Transcription

1 Lecture 20 Randomness and Monte Carlo J. Chaudhry Department of Mathematics and Statistics University of New Mexico J. Chaudhry (UNM) CS / 40

2 What we ll do: Random number generators Monte-Carlo integration Monte-Carlo simulation Our testing and our methods often rely on randomness and the impact of finite precision Random input Random perturbations Random sequences J. Chaudhry (UNM) CS / 40

3 Randomness Randomness unpredictability One view: a sequence is random if it has no shorter description Physical processes, such as flipping a coin or tossing dice, are deterministic with enough information about the governing equations and initial conditions. But even for deterministic systems, sensitivity to the initial conditions can render the behavior practically unpredictable. we need random simulation methods J. Chaudhry (UNM) CS / 40

4 Quasi-Random Sequences For some applications, reasonable uniform coverage of the sample is more important than the randomness True random samples often exhibit clumping Perfectly uniform samples uses a uniform grid, but does not scale well at high dimensions quasi-random sequences attempt randomness while maintaining coverage J. Chaudhry (UNM) CS / 40

5 Quasi-Random Sequences quasi random sequences are not random, but give random appearance by design, the points avoid each other, resulting in no clumping J. Chaudhry (UNM) CS / 40

6 Randomness is easy, right? In May, 2008, Debian announced a vulnerability with OpenSSL: the OpenSSL pseudo-random number generator the seeding process was compromised (2 years) only 32,767 possible keys seeding based on process ID (this is not entropy!) all SSL and SSH keys from 9/2006-5/2008 regenerated all certificates recertified Cryptographically secure pseudorandom number generator (CSPRNG) are necessary for some apps Other apps rely less on true randomness J. Chaudhry (UNM) CS / 40

7 Repeatability With unpredictability, true randomness is not repeatable...but lack of repeatability makes testing/debugging difficult So we want repeatability, but also independence of the trials 1 >> rand( seed,1234) 2 >> rand(10,1) J. Chaudhry (UNM) CS / 40

8 Pseudorandom Numbers Computer algorithms for random number generations are deterministic...but may have long periodicity (a long time until an apparent pattern emerges) These sequences are labeled pseudorandom Pseudorandom sequences are predictable and reproducible (this is mostly good) J. Chaudhry (UNM) CS / 40

9 Random Number Generators Properties of a good random number generator: Random pattern: passes statistical tests of randomness Long period: long time before repeating Efficiency: executes rapidly and with low storage Repeatability: same sequence is generated using same initial states Portability: same sequences are generated on different architectures J. Chaudhry (UNM) CS / 40

10 Random Number Generators Early attempts relied on complexity to ensure randomness midsquare method: square each member of a sequence and take the middle portion of the results as the next member of the sequence...simple methods with a statistical basis are preferable J. Chaudhry (UNM) CS / 40

11 Linear Congruential Generators Congruential random number generators are of the form: x k = (ax k 1 + c) ( mod m) where a and c are integers given as input. x 0 is called the seed Integer m is the largest integer representable (e.g ) Quality depends on a and c. The period will be at most m. Example Let a = 13, c = 0, m = 31, and x 0 = 1. 1, 13, 14, 27, 10, 6,... This is a permutation of integers from 1,..., 30, so the period is m 1. J. Chaudhry (UNM) CS / 40

12 History From C. Moler, emphncm IBM used Scientific Subroutine Package (SSP) in the 1960 s the mainframes. Their random generator, rnd used a = 65539, c = 0, and m = arithmetic mod 2 31 is done quickly with 32 bit words. multiplication can be done quickly with a = with a shift and short add. Notice (mod m): x k+2 = 6x k+1 9x k...strong correlation among three successive integers J. Chaudhry (UNM) CS / 40

13 History From C. Moler, NCM Matlab used a = 7 5, c = 0, and m = for a while period is m 1. this is no longer sufficient J. Chaudhry (UNM) CS / 40

14 what s used? Two popular methods: 1. Method of Marsaglia (period ). 1 Initialize x 0,..., x 3 and c to random values given a seed 2 3 Let s = x n x n x n x n 1 + c 4 5 Compute x n = s mod c = floor(s/2 32 ) 2. rand() in Unix uses a = , c = 12345, m = In general, the digits in random numbers are not themselves random...some patterns reoccur much more often. J. Chaudhry (UNM) CS / 40

15 Linear Congruential Generators sensitive to a and c be careful with supplied random functions on your system period is m standard division is necessary if generating floating points in [0, 1). J. Chaudhry (UNM) CS / 40

16 Fibonacci produce floating-point random numbers directly using differences, sums, or products. Typical subtractive generator: x k = x k 17 x k 5 with lags of 17 and 5. Lags much be chosen very carefully negative results need fixing more storage needed than congruential generators no division needed very very good statistical properties long periods since repetition does not imply a period J. Chaudhry (UNM) CS / 40

17 Discrete random variables random variable x values: x 0, x 1,..., x n probabilities p 0, p 1,..., p n with n i=0 p i = 1 throwing a die (1-based index) values: x 1 = 1, x 2 = 2,..., x 6 = 6 probabilities p i = 1/6 J. Chaudhry (UNM) CS / 40

18 Expected value and variance expected value: average value of the variable E[x] = n x j p j j=1 variance: variation from the average σ 2 [x] = E[(x E[x]) 2 ] = E[x 2 ] E[x] 2 throwing a die expected value: E[x] = ( )/6 = 3.5 variance: σ 2 [x] = J. Chaudhry (UNM) CS / 40

19 estimated E[x] to estimate the expected value, choose a set of random values based on the probability and average the results N E[x] = 1 N j=1 x i bigger N gives better estimates throwing a die 3 rolls: 3, 1, 6 E[x] ( )/3 = rolls: 3, 1, 6, 2, 5, 3, 4, 6, 2 E[x] ( )/9 = 3.51 J. Chaudhry (UNM) CS / 40

20 Law of large numbers by taking N to, the error between the estimate and the expected value is statistically zero. That is, the estimate will converge to the correct value P(E[x] = lim N 1 N N x i ) = 1 This is the basic idea behind Monte Carlo estimation i=1 J. Chaudhry (UNM) CS / 40

21 Continuous random variable and density function random variable: x values: x [a, b] probability: density function ρ(x) with b a ρ(x) dx = 1 probability that the variable has value between (c, d) [a, b]: d c ρ(x) J. Chaudhry (UNM) CS / 40

22 Uniformly distributed random variable ρ(x) is constant b a ρ(x) dx = 1 means ρ(x) = 1/(b a) J. Chaudhry (UNM) CS / 40

23 Continuous extensions to expectation and variance expected value E[x] = E[g(x)] = variance σ 2 [x] = σ 2 [g(x)] = b a b a b a b a xρ(x) dx g(x)ρ(x) dx (x E[x]) 2 ρ(x) dx = E[x 2 ] (E[x]) 2 (g(x) E[g(x)]) 2 p(x) dx = E[g(x) 2 ] (E[g(x)]) 2 estimating the expected value E[g(x)] 1 N N g(x i ) J. Chaudhry (UNM) CS / 40 i=1

24 multidementional extensions difficult domains (complex geometries) expected value E[g(x)] = g(x)ρ(x) da x x D J. Chaudhry (UNM) CS / 40

25 Sampling over intervals Almost all systems provide a uniform random number generator on (0, 1) Matlab: rand If we need a uniform distribution over (a, b), then we modify x k on (0, 1) by (b a)x k + a Matlab: Generate 100 uniformly distributed values between (a, b) r = a + (b-a).*rand(100,1) Uniformly distributed integers: randi Random permutations: randperm J. Chaudhry (UNM) CS / 40

26 Non-uniform distributions sampling nonuniform distributions is much more difficult if the cumulative distribution function is invertible, then we can generate the non-uniform sample from the uniform. Consider probability density function ρ(t) = λe λt, t > 0 giving the cumulative distribution function as x x F(x) = λe λt dt = (e λt ) = (1 e λx ) thus inverting the CDF where y k is uniform in (0, 1)....not so easy in general 0 x k = log(1 y k )/λ 0 J. Chaudhry (UNM) CS / 40

27 Monte Carlo Central to the PageRank (and many many other applications in fincance, science, informatics, etc) is that we randomly process something what we want to know is on average what is likely to happen what would happen if we have an infinite number of samples? let s take a look at integral (a discrete limit in a sense) J. Chaudhry (UNM) CS / 40

28 (deterministic) numerical integration split domain into set of fixed segments sum function values with size of segments (Riemann!) J. Chaudhry (UNM) CS / 40

29 Monte Carlo Integration We have for a random sequence x 1,..., x n 1 0 f (x) dx 1 n n f (x i ) i=1 1 n=100; 2 x=rand(n,1); 3 a=f(x); 4 s=sum(a)/n; J. Chaudhry (UNM) CS / 40

30 Monte Carlo over random domains We have for a random sequence x 1,..., x n in Ω I = Ω f (x) dx Q n = V 1 n where V is the volume given by V = Ω dx n f (x i ) Law of large numbers gurantees that Q n I as n Works in any dimension! One dimension: b a f (x) dx (b a) 1 n i=1 n f (x i ) i=1 where x 1,..., x n are uniformly distributed in (a, b) J. Chaudhry (UNM) CS / 40

31 2d example: computing π Use the unit square [0, 1] 2 with a quarter-circle { 1 (x, y) circle f (x, y) = 0 else A quarter circle = f (x, y) dxdy = pi 4 J. Chaudhry (UNM) CS / 40

32 2d example: computing π Estimate the area of the circle by randomly evaluating f (x, y) A quarter circle 1 N N f (x i, y i ) i=1 J. Chaudhry (UNM) CS / 40

33 2d example: computing π By definition A quarter circle = π/4 so π 4 N N f (x i, y i ) i=1 J. Chaudhry (UNM) CS / 40

34 2d example: computing π algorithm 1 input N 2 call rand in 2d 3 for i=1:n 4 sum = sum + f (x i, y i ) 5 end 6 sum = 4 sum/n J. Chaudhry (UNM) CS / 40

35 2d example: computing π algorithm The expected value of the error is O( 1 N ) convergence does not depend on dimension deterministic integration is very hard in higher dimensions deterministic integration is very hard for complicated domains Trapezoid rule in dimension d: O( 1 N 2/d ) J. Chaudhry (UNM) CS / 40

36 Error in Monte Carlo Estimation The distribution of an average is close to being normal, even when the distribution from which the average is computed is not normal. What? Let x 1,..., x n be some independent random variables from any PDF Each x i has expected value µ and standard deviation σ Consider the Average A n = (x x n )/n The expected value of A n is µ and the standard deviation is σ n This follows from Central Limit Theorem What? The sample mean has an error of σ/ n J. Chaudhry (UNM) CS / 40

37 Stochastic Simulation Stochastic simulation mimics physical behavior through random simulations...also known as Monte Carlo method (no single MC method!) Usefulness: nondeterministic processes deterministic models that are too complicated to model deterministic models with high dimensionality J. Chaudhry (UNM) CS / 40

38 Stochastic Simulation Two requirements for MC: knowing which probability distributions are needed generating sufficient random numbers The probability distribution depends on the problem (theoretical or empirical evidence) The probability distribution can be approximated well by simulating a large number of trials J. Chaudhry (UNM) CS / 40

39 Stochastic Simulation: The Monte Hall Problem Question You are on a gameshow. There are three doors that you have the option of opening. There is a prize behind one of the doors, and there are goats behind the other two. You select one of the doors. One of the remaining two doors is opened to reveal a goat. You are then given the option of opening your door or the other remaining unopened door. Should you switch. Determine the probability that you will win the prize if you switch. Answer: Yes, always switch. Probability of success is 2/3. Can show using conditinal probability J. Chaudhry (UNM) CS / 40

40 Stochastic Simulation: The Monte Hall Problem Solution via random simuation 1 input N 2 wins = 0 3 for i=1:n 4 Generate random permutation of goats and prize 5 You randomly choose a door 6 if the door had a goat, host always chooses the other door with the goat 7 else if the door had a prize, host randomly chooses one of the doors with the goat 8 end 9 You switch your choice 0 if the switched door had the prize 1 wins = wins end 3 4 end 5 probability of success = wins/n J. Chaudhry (UNM) CS / 40

Random processes and probability distributions. Phys 420/580 Lecture 20

Random processes and probability distributions. Phys 420/580 Lecture 20 Random processes and probability distributions Phys 420/580 Lecture 20 Random processes Many physical processes are random in character: e.g., nuclear decay (Poisson distributed event count) P (k, τ) =

More information

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint Chapter 4: Monte Carlo Methods Paisan Nakmahachalasint Introduction Monte Carlo Methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo

More information

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky Monte Carlo Lecture 15 4/9/18 1 Sampling with dynamics In Molecular Dynamics we simulate evolution of a system over time according to Newton s equations, conserving energy Averages (thermodynamic properties)

More information

Monte Carlo Integration. Computer Graphics CMU /15-662, Fall 2016

Monte Carlo Integration. Computer Graphics CMU /15-662, Fall 2016 Monte Carlo Integration Computer Graphics CMU 15-462/15-662, Fall 2016 Talk Announcement Jovan Popovic, Senior Principal Scientist at Adobe Research will be giving a seminar on Character Animator -- Monday

More information

How does the computer generate observations from various distributions specified after input analysis?

How does the computer generate observations from various distributions specified after input analysis? 1 How does the computer generate observations from various distributions specified after input analysis? There are two main components to the generation of observations from probability distributions.

More information

Uniform Random Number Generators

Uniform Random Number Generators JHU 553.633/433: Monte Carlo Methods J. C. Spall 25 September 2017 CHAPTER 2 RANDOM NUMBER GENERATION Motivation and criteria for generators Linear generators (e.g., linear congruential generators) Multiple

More information

2 Random Variable Generation

2 Random Variable Generation 2 Random Variable Generation Most Monte Carlo computations require, as a starting point, a sequence of i.i.d. random variables with given marginal distribution. We describe here some of the basic methods

More information

Review of Statistical Terminology

Review of Statistical Terminology Review of Statistical Terminology An experiment is a process whose outcome is not known with certainty. The experiment s sample space S is the set of all possible outcomes. A random variable is a function

More information

Department of Electrical- and Information Technology. ETS061 Lecture 3, Verification, Validation and Input

Department of Electrical- and Information Technology. ETS061 Lecture 3, Verification, Validation and Input ETS061 Lecture 3, Verification, Validation and Input Verification and Validation Real system Validation Model Verification Measurements Verification Break model down into smaller bits and test each bit

More information

CS 361: Probability & Statistics

CS 361: Probability & Statistics February 12, 2018 CS 361: Probability & Statistics Random Variables Monty hall problem Recall the setup, there are 3 doors, behind two of them are indistinguishable goats, behind one is a car. You pick

More information

Random Number Generation. CS1538: Introduction to simulations

Random Number Generation. CS1538: Introduction to simulations Random Number Generation CS1538: Introduction to simulations Random Numbers Stochastic simulations require random data True random data cannot come from an algorithm We must obtain it from some process

More information

2905 Queueing Theory and Simulation PART IV: SIMULATION

2905 Queueing Theory and Simulation PART IV: SIMULATION 2905 Queueing Theory and Simulation PART IV: SIMULATION 22 Random Numbers A fundamental step in a simulation study is the generation of random numbers, where a random number represents the value of a random

More information

Slides 3: Random Numbers

Slides 3: Random Numbers Slides 3: Random Numbers We previously considered a few examples of simulating real processes. In order to mimic real randomness of events such as arrival times we considered the use of random numbers

More information

CPSC 531: Random Numbers. Jonathan Hudson Department of Computer Science University of Calgary

CPSC 531: Random Numbers. Jonathan Hudson Department of Computer Science University of Calgary CPSC 531: Random Numbers Jonathan Hudson Department of Computer Science University of Calgary http://www.ucalgary.ca/~hudsonj/531f17 Introduction In simulations, we generate random values for variables

More information

Scientific Computing: Monte Carlo

Scientific Computing: Monte Carlo Scientific Computing: Monte Carlo Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course MATH-GA.2043 or CSCI-GA.2112, Spring 2012 April 5th and 12th, 2012 A. Donev (Courant Institute)

More information

Random Number Generators

Random Number Generators 1/18 Random Number Generators Professor Karl Sigman Columbia University Department of IEOR New York City USA 2/18 Introduction Your computer generates" numbers U 1, U 2, U 3,... that are considered independent

More information

Math 180A. Lecture 16 Friday May 7 th. Expectation. Recall the three main probability density functions so far (1) Uniform (2) Exponential.

Math 180A. Lecture 16 Friday May 7 th. Expectation. Recall the three main probability density functions so far (1) Uniform (2) Exponential. Math 8A Lecture 6 Friday May 7 th Epectation Recall the three main probability density functions so far () Uniform () Eponential (3) Power Law e, ( ), Math 8A Lecture 6 Friday May 7 th Epectation Eample

More information

Topics in Computer Mathematics

Topics in Computer Mathematics Random Number Generation (Uniform random numbers) Introduction We frequently need some way to generate numbers that are random (by some criteria), especially in computer science. Simulations of natural

More information

Random Number Generators - a brief assessment of those available

Random Number Generators - a brief assessment of those available Random Number Generators - a brief assessment of those available Anna Mills March 30, 2003 1 Introduction Nothing in nature is random...a thing appears random only through the incompleteness of our knowledge.

More information

From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that

From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that From Random Numbers to Monte Carlo Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that Random Walk Through Life Random Walk Through Life If you flip the coin 5 times you will

More information

2008 Winton. Review of Statistical Terminology

2008 Winton. Review of Statistical Terminology 1 Review of Statistical Terminology 2 Formal Terminology An experiment is a process whose outcome is not known with certainty The experiment s sample space S is the set of all possible outcomes. A random

More information

Lecture 2 : CS6205 Advanced Modeling and Simulation

Lecture 2 : CS6205 Advanced Modeling and Simulation Lecture 2 : CS6205 Advanced Modeling and Simulation Lee Hwee Kuan 21 Aug. 2013 For the purpose of learning stochastic simulations for the first time. We shall only consider probabilities on finite discrete

More information

Northwestern University Department of Electrical Engineering and Computer Science

Northwestern University Department of Electrical Engineering and Computer Science Northwestern University Department of Electrical Engineering and Computer Science EECS 454: Modeling and Analysis of Communication Networks Spring 2008 Probability Review As discussed in Lecture 1, probability

More information

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring Independent Events Two events are independent if knowing that one occurs does not change the probability of the other occurring Conditional probability is denoted P(A B), which is defined to be: P(A and

More information

Discrete Random Variables

Discrete Random Variables Discrete Random Variables An Undergraduate Introduction to Financial Mathematics J. Robert Buchanan 2014 Introduction The markets can be thought of as a complex interaction of a large number of random

More information

Basics on Probability. Jingrui He 09/11/2007

Basics on Probability. Jingrui He 09/11/2007 Basics on Probability Jingrui He 09/11/2007 Coin Flips You flip a coin Head with probability 0.5 You flip 100 coins How many heads would you expect Coin Flips cont. You flip a coin Head with probability

More information

IE 581 Introduction to Stochastic Simulation. One page of notes, front and back. Closed book. 50 minutes. Score

IE 581 Introduction to Stochastic Simulation. One page of notes, front and back. Closed book. 50 minutes. Score One page of notes, front and back. Closed book. 50 minutes. Score Schmeiser Page 1 of 4 Test #1, Spring 2001 1. True or false. (If you wish, write an explanation of your thinking.) (a) T Data are "binary"

More information

How does the computer generate observations from various distributions specified after input analysis?

How does the computer generate observations from various distributions specified after input analysis? 1 How does the computer generate observations from various distributions specified after input analysis? There are two main components to the generation of observations from probability distributions.

More information

First Digit Tally Marks Final Count

First Digit Tally Marks Final Count Benford Test () Imagine that you are a forensic accountant, presented with the two data sets on this sheet of paper (front and back). Which of the two sets should be investigated further? Why? () () ()

More information

Discrete Random Variables

Discrete Random Variables Discrete Random Variables An Undergraduate Introduction to Financial Mathematics J. Robert Buchanan Introduction The markets can be thought of as a complex interaction of a large number of random processes,

More information

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

STAT2201. Analysis of Engineering & Scientific Data. Unit 3 STAT2201 Analysis of Engineering & Scientific Data Unit 3 Slava Vaisman The University of Queensland School of Mathematics and Physics What we learned in Unit 2 (1) We defined a sample space of a random

More information

Recitation 2: Probability

Recitation 2: Probability Recitation 2: Probability Colin White, Kenny Marino January 23, 2018 Outline Facts about sets Definitions and facts about probability Random Variables and Joint Distributions Characteristics of distributions

More information

Hochdimensionale Integration

Hochdimensionale Integration Oliver Ernst Institut für Numerische Mathematik und Optimierung Hochdimensionale Integration 14-tägige Vorlesung im Wintersemester 2010/11 im Rahmen des Moduls Ausgewählte Kapitel der Numerik Contents

More information

Numerical Methods I Monte Carlo Methods

Numerical Methods I Monte Carlo Methods Numerical Methods I Monte Carlo Methods Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course G63.2010.001 / G22.2420-001, Fall 2010 Dec. 9th, 2010 A. Donev (Courant Institute) Lecture

More information

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds Applied Numerical Analysis Pseudo Random Number Generator Lecturer: Emad Fatemizadeh What is random number: A sequence in which each term is unpredictable 29, 95, 11, 60, 22 Application: Monte Carlo Simulations

More information

What is a random variable

What is a random variable OKAN UNIVERSITY FACULTY OF ENGINEERING AND ARCHITECTURE MATH 256 Probability and Random Processes 04 Random Variables Fall 20 Yrd. Doç. Dr. Didem Kivanc Tureli didemk@ieee.org didem.kivanc@okan.edu.tr

More information

The random variable 1

The random variable 1 The random variable 1 Contents 1. Definition 2. Distribution and density function 3. Specific random variables 4. Functions of one random variable 5. Mean and variance 2 The random variable A random variable

More information

Simulation. Where real stuff starts

Simulation. Where real stuff starts 1 Simulation Where real stuff starts ToC 1. What is a simulation? 2. Accuracy of output 3. Random Number Generators 4. How to sample 5. Monte Carlo 6. Bootstrap 2 1. What is a simulation? 3 What is a simulation?

More information

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 10

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 10 EECS 70 Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 10 Introduction to Basic Discrete Probability In the last note we considered the probabilistic experiment where we flipped

More information

ECE Homework Set 2

ECE Homework Set 2 1 Solve these problems after Lecture #4: Homework Set 2 1. Two dice are tossed; let X be the sum of the numbers appearing. a. Graph the CDF, FX(x), and the pdf, fx(x). b. Use the CDF to find: Pr(7 X 9).

More information

STAT 430/510 Probability Lecture 7: Random Variable and Expectation

STAT 430/510 Probability Lecture 7: Random Variable and Expectation STAT 430/510 Probability Lecture 7: Random Variable and Expectation Pengyuan (Penelope) Wang June 2, 2011 Review Properties of Probability Conditional Probability The Law of Total Probability Bayes Formula

More information

Review of Probability. CS1538: Introduction to Simulations

Review of Probability. CS1538: Introduction to Simulations Review of Probability CS1538: Introduction to Simulations Probability and Statistics in Simulation Why do we need probability and statistics in simulation? Needed to validate the simulation model Needed

More information

Contents. 1 Probability review Introduction Random variables and distributions Convergence of random variables...

Contents. 1 Probability review Introduction Random variables and distributions Convergence of random variables... Contents Probability review. Introduction..............................2 Random variables and distributions................ 3.3 Convergence of random variables................. 6 2 Monte Carlo methods

More information

Analysis of Engineering and Scientific Data. Semester

Analysis of Engineering and Scientific Data. Semester Analysis of Engineering and Scientific Data Semester 1 2019 Sabrina Streipert s.streipert@uq.edu.au Example: Draw a random number from the interval of real numbers [1, 3]. Let X represent the number. Each

More information

Course: ESO-209 Home Work: 1 Instructor: Debasis Kundu

Course: ESO-209 Home Work: 1 Instructor: Debasis Kundu Home Work: 1 1. Describe the sample space when a coin is tossed (a) once, (b) three times, (c) n times, (d) an infinite number of times. 2. A coin is tossed until for the first time the same result appear

More information

X 1 ((, a]) = {ω Ω : X(ω) a} F, which leads us to the following definition:

X 1 ((, a]) = {ω Ω : X(ω) a} F, which leads us to the following definition: nna Janicka Probability Calculus 08/09 Lecture 4. Real-valued Random Variables We already know how to describe the results of a random experiment in terms of a formal mathematical construction, i.e. the

More information

Simulation. Where real stuff starts

Simulation. Where real stuff starts Simulation Where real stuff starts March 2019 1 ToC 1. What is a simulation? 2. Accuracy of output 3. Random Number Generators 4. How to sample 5. Monte Carlo 6. Bootstrap 2 1. What is a simulation? 3

More information

Random variables. DS GA 1002 Probability and Statistics for Data Science.

Random variables. DS GA 1002 Probability and Statistics for Data Science. Random variables DS GA 1002 Probability and Statistics for Data Science http://www.cims.nyu.edu/~cfgranda/pages/dsga1002_fall17 Carlos Fernandez-Granda Motivation Random variables model numerical quantities

More information

IE 581 Introduction to Stochastic Simulation. One page of notes, front and back. Closed book. 50 minutes. Score

IE 581 Introduction to Stochastic Simulation. One page of notes, front and back. Closed book. 50 minutes. Score One page of notes, front and back. Closed book. 50 minutes. Score Schmeiser Page 1 of 4 Test #1, Spring 2001 1. True or false. (If you wish, write an explanation of your thinking.) (a) T F Data are "binary"

More information

Statistics 100A Homework 5 Solutions

Statistics 100A Homework 5 Solutions Chapter 5 Statistics 1A Homework 5 Solutions Ryan Rosario 1. Let X be a random variable with probability density function a What is the value of c? fx { c1 x 1 < x < 1 otherwise We know that for fx to

More information

Random number generators

Random number generators s generators Comp Sci 1570 Introduction to Outline s 1 2 s generator s The of a sequence of s or symbols that cannot be reasonably predicted better than by a random chance, usually through a random- generator

More information

Preliminary statistics

Preliminary statistics 1 Preliminary statistics The solution of a geophysical inverse problem can be obtained by a combination of information from observed data, the theoretical relation between data and earth parameters (models),

More information

Elementary Discrete Probability

Elementary Discrete Probability Elementary Discrete Probability MATH 472 Financial Mathematics J Robert Buchanan 2018 Objectives In this lesson we will learn: the terminology of elementary probability, elementary rules of probability,

More information

Uniform random numbers generators

Uniform random numbers generators Uniform random numbers generators Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/kurssit/tlt-2707/ OUTLINE: The need for random numbers; Basic steps in generation; Uniformly

More information

More General Functions Is this technique limited to the monomials {1, x, x 2, x 3,...}?

More General Functions Is this technique limited to the monomials {1, x, x 2, x 3,...}? More General Functions Is this technique limited to the monomials {1, x, x 2, x 3,...}? Interpolation with General Sets of Functions For a general set of functions {ϕ 1,..., ϕ n }, solve the linear system

More information

2. Variance and Covariance: We will now derive some classic properties of variance and covariance. Assume real-valued random variables X and Y.

2. Variance and Covariance: We will now derive some classic properties of variance and covariance. Assume real-valued random variables X and Y. CS450 Final Review Problems Fall 08 Solutions or worked answers provided Problems -6 are based on the midterm review Identical problems are marked recap] Please consult previous recitations and textbook

More information

Computer Applications for Engineers ET 601

Computer Applications for Engineers ET 601 Computer Applications for Engineers ET 601 Asst. Prof. Dr. Prapun Suksompong prapun@siit.tu.ac.th Random Variables (Con t) 1 Office Hours: (BKD 3601-7) Wednesday 9:30-11:30 Wednesday 16:00-17:00 Thursday

More information

Random number generators and random processes. Statistics and probability intro. Peg board example. Peg board example. Notes. Eugeniy E.

Random number generators and random processes. Statistics and probability intro. Peg board example. Peg board example. Notes. Eugeniy E. Random number generators and random processes Eugeniy E. Mikhailov The College of William & Mary Lecture 11 Eugeniy Mikhailov (W&M) Practical Computing Lecture 11 1 / 11 Statistics and probability intro

More information

Monty Hall Puzzle. Draw a tree diagram of possible choices (a possibility tree ) One for each strategy switch or no-switch

Monty Hall Puzzle. Draw a tree diagram of possible choices (a possibility tree ) One for each strategy switch or no-switch Monty Hall Puzzle Example: You are asked to select one of the three doors to open. There is a large prize behind one of the doors and if you select that door, you win the prize. After you select a door,

More information

Random number generation

Random number generation CE 391F April 4, 2013 ANNOUNCEMENTS Homework 3 due today Homework 4 coming... Announcements Webinar announcement Femke van Wageningen-Kessels from TU Delft will be giving a webinar titled Traffic Flow

More information

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal CSE 311 Lecture 13: Primes and GCD Emina Torlak and Kevin Zatloukal 1 Topics Modular arithmetic applications A quick wrap-up of Lecture 12. Primes Fundamental theorem of arithmetic, Euclid s theorem, factoring.

More information

DUBLIN CITY UNIVERSITY

DUBLIN CITY UNIVERSITY DUBLIN CITY UNIVERSITY SAMPLE EXAMINATIONS 2017/2018 MODULE: QUALIFICATIONS: Simulation for Finance MS455 B.Sc. Actuarial Mathematics ACM B.Sc. Financial Mathematics FIM YEAR OF STUDY: 4 EXAMINERS: Mr

More information

Hand Simulations. Christos Alexopoulos and Dave Goldsman 9/2/14. Georgia Institute of Technology, Atlanta, GA, USA 1 / 26

Hand Simulations. Christos Alexopoulos and Dave Goldsman 9/2/14. Georgia Institute of Technology, Atlanta, GA, USA 1 / 26 1 / 26 Hand Simulations Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA 9/2/14 2 / 26 Outline 1 Monte Carlo Integration 2 Making Some π 3 Single-Server Queue 4

More information

SUMMARY OF PROBABILITY CONCEPTS SO FAR (SUPPLEMENT FOR MA416)

SUMMARY OF PROBABILITY CONCEPTS SO FAR (SUPPLEMENT FOR MA416) SUMMARY OF PROBABILITY CONCEPTS SO FAR (SUPPLEMENT FOR MA416) D. ARAPURA This is a summary of the essential material covered so far. The final will be cumulative. I ve also included some review problems

More information

Lecture 1: Basics of Probability

Lecture 1: Basics of Probability Lecture 1: Basics of Probability (Luise-Vitetta, Chapter 8) Why probability in data science? Data acquisition is noisy Sampling/quantization external factors: If you record your voice saying machine learning

More information

Chapter 2. Random Variable. Define single random variables in terms of their PDF and CDF, and calculate moments such as the mean and variance.

Chapter 2. Random Variable. Define single random variables in terms of their PDF and CDF, and calculate moments such as the mean and variance. Chapter 2 Random Variable CLO2 Define single random variables in terms of their PDF and CDF, and calculate moments such as the mean and variance. 1 1. Introduction In Chapter 1, we introduced the concept

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

20.1 2SAT. CS125 Lecture 20 Fall 2016

20.1 2SAT. CS125 Lecture 20 Fall 2016 CS125 Lecture 20 Fall 2016 20.1 2SAT We show yet another possible way to solve the 2SAT problem. Recall that the input to 2SAT is a logical expression that is the conunction (AND) of a set of clauses,

More information

Simulation Modeling. Random Numbers

Simulation Modeling. Random Numbers Mathematical Modeling Lia Vas Simulation Modeling. Random Numbers In many cases one of the following situations might occur: - It is not possible to observe the behavior directly or to conduct experiments.

More information

A Repetition Test for Pseudo-Random Number Generators

A Repetition Test for Pseudo-Random Number Generators Monte Carlo Methods and Appl., Vol. 12, No. 5-6, pp. 385 393 (2006) c VSP 2006 A Repetition Test for Pseudo-Random Number Generators Manuel Gil, Gaston H. Gonnet, Wesley P. Petersen SAM, Mathematik, ETHZ,

More information

Chapter 3, 4 Random Variables ENCS Probability and Stochastic Processes. Concordia University

Chapter 3, 4 Random Variables ENCS Probability and Stochastic Processes. Concordia University Chapter 3, 4 Random Variables ENCS6161 - Probability and Stochastic Processes Concordia University ENCS6161 p.1/47 The Notion of a Random Variable A random variable X is a function that assigns a real

More information

Uniform Random Binary Floating Point Number Generation

Uniform Random Binary Floating Point Number Generation Uniform Random Binary Floating Point Number Generation Prof. Dr. Thomas Morgenstern, Phone: ++49.3943-659-337, Fax: ++49.3943-659-399, tmorgenstern@hs-harz.de, Hochschule Harz, Friedrichstr. 57-59, 38855

More information

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6 MTH739U/P: Topics in Scientific Computing Autumn 16 Week 6 4.5 Generic algorithms for non-uniform variates We have seen that sampling from a uniform distribution in [, 1] is a relatively straightforward

More information

Monte Carlo Techniques

Monte Carlo Techniques Physics 75.502 Part III: Monte Carlo Methods 40 Monte Carlo Techniques Monte Carlo refers to any procedure that makes use of random numbers. Monte Carlo methods are used in: Simulation of natural phenomena

More information

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers To sample a function in a statistically controlled manner (i.e. for Monte Carlo integration)

More information

Stochastic Models of Manufacturing Systems

Stochastic Models of Manufacturing Systems Stochastic Models of Manufacturing Systems Ivo Adan Probabilistic problems 2/72 Test your feeling for probabilities: Birthday problem Coin-flipping Scratch-and-win lottery Coincidence problem Boarding

More information

Lecture 3. Discrete Random Variables

Lecture 3. Discrete Random Variables Math 408 - Mathematical Statistics Lecture 3. Discrete Random Variables January 23, 2013 Konstantin Zuev (USC) Math 408, Lecture 3 January 23, 2013 1 / 14 Agenda Random Variable: Motivation and Definition

More information

Generating Random Variables

Generating Random Variables Generating Random Variables These slides are created by Dr. Yih Huang of George Mason University. Students registered in Dr. Huang's courses at GMU can make a single machine-readable copy and print a single

More information

Introduction to Machine Learning

Introduction to Machine Learning What does this mean? Outline Contents Introduction to Machine Learning Introduction to Probabilistic Methods Varun Chandola December 26, 2017 1 Introduction to Probability 1 2 Random Variables 3 3 Bayes

More information

DS-GA 1002 Lecture notes 2 Fall Random variables

DS-GA 1002 Lecture notes 2 Fall Random variables DS-GA 12 Lecture notes 2 Fall 216 1 Introduction Random variables Random variables are a fundamental tool in probabilistic modeling. They allow us to model numerical quantities that are uncertain: the

More information

Stochastic Models of Manufacturing Systems

Stochastic Models of Manufacturing Systems Stochastic Models of Manufacturing Systems Ivo Adan Organization 2/47 7 lectures (lecture of May 12 is canceled) Studyguide available (with notes, slides, assignments, references), see http://www.win.tue.nl/

More information

Monte Carlo Integration II & Sampling from PDFs

Monte Carlo Integration II & Sampling from PDFs Monte Carlo Integration II & Sampling from PDFs CS295, Spring 2017 Shuang Zhao Computer Science Department University of California, Irvine CS295, Spring 2017 Shuang Zhao 1 Last Lecture Direct illumination

More information

Numerical methods for lattice field theory

Numerical methods for lattice field theory Numerical methods for lattice field theory Mike Peardon Trinity College Dublin August 9, 2007 Mike Peardon (Trinity College Dublin) Numerical methods for lattice field theory August 9, 2007 1 / 37 Numerical

More information

Probability Theory. Introduction to Probability Theory. Principles of Counting Examples. Principles of Counting. Probability spaces.

Probability Theory. Introduction to Probability Theory. Principles of Counting Examples. Principles of Counting. Probability spaces. Probability Theory To start out the course, we need to know something about statistics and probability Introduction to Probability Theory L645 Advanced NLP Autumn 2009 This is only an introduction; for

More information

Differentiation and Integration

Differentiation and Integration Differentiation and Integration (Lectures on Numerical Analysis for Economists II) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 February 12, 2018 1 University of Pennsylvania 2 Boston College Motivation

More information

02 Background Minimum background on probability. Random process

02 Background Minimum background on probability. Random process 0 Background 0.03 Minimum background on probability Random processes Probability Conditional probability Bayes theorem Random variables Sampling and estimation Variance, covariance and correlation Probability

More information

Random Variables and Their Distributions

Random Variables and Their Distributions Chapter 3 Random Variables and Their Distributions A random variable (r.v.) is a function that assigns one and only one numerical value to each simple event in an experiment. We will denote r.vs by capital

More information

Class 8 Review Problems 18.05, Spring 2014

Class 8 Review Problems 18.05, Spring 2014 1 Counting and Probability Class 8 Review Problems 18.05, Spring 2014 1. (a) How many ways can you arrange the letters in the word STATISTICS? (e.g. SSSTTTIIAC counts as one arrangement.) (b) If all arrangements

More information

Math 151. Rumbos Fall Solutions to Review Problems for Exam 2. Pr(X = 1) = ) = Pr(X = 2) = Pr(X = 3) = p X. (k) =

Math 151. Rumbos Fall Solutions to Review Problems for Exam 2. Pr(X = 1) = ) = Pr(X = 2) = Pr(X = 3) = p X. (k) = Math 5. Rumbos Fall 07 Solutions to Review Problems for Exam. A bowl contains 5 chips of the same size and shape. Two chips are red and the other three are blue. Draw three chips from the bowl at random,

More information

Review of Probability Theory

Review of Probability Theory Review of Probability Theory Arian Maleki and Tom Do Stanford University Probability theory is the study of uncertainty Through this class, we will be relying on concepts from probability theory for deriving

More information

Random Variables. Statistics 110. Summer Copyright c 2006 by Mark E. Irwin

Random Variables. Statistics 110. Summer Copyright c 2006 by Mark E. Irwin Random Variables Statistics 110 Summer 2006 Copyright c 2006 by Mark E. Irwin Random Variables A Random Variable (RV) is a response of a random phenomenon which is numeric. Examples: 1. Roll a die twice

More information

Simulation. Version 1.1 c 2010, 2009, 2001 José Fernando Oliveira Maria Antónia Carravilla FEUP

Simulation. Version 1.1 c 2010, 2009, 2001 José Fernando Oliveira Maria Antónia Carravilla FEUP Simulation Version 1.1 c 2010, 2009, 2001 José Fernando Oliveira Maria Antónia Carravilla FEUP Systems - why simulate? System any object or entity on which a particular study is run. Model representation

More information

General Principles in Random Variates Generation

General Principles in Random Variates Generation General Principles in Random Variates Generation E. Moulines and G. Fort Telecom ParisTech June 2015 Bibliography : Luc Devroye, Non-Uniform Random Variate Generator, Springer-Verlag (1986) available on

More information

Uniform and Exponential Random Floating Point Number Generation

Uniform and Exponential Random Floating Point Number Generation Uniform and Exponential Random Floating Point Number Generation Thomas Morgenstern Hochschule Harz, Friedrichstr. 57-59, D-38855 Wernigerode tmorgenstern@hs-harz.de Summary. Pseudo random number generators

More information

Chapter 2: Random Variables

Chapter 2: Random Variables ECE54: Stochastic Signals and Systems Fall 28 Lecture 2 - September 3, 28 Dr. Salim El Rouayheb Scribe: Peiwen Tian, Lu Liu, Ghadir Ayache Chapter 2: Random Variables Example. Tossing a fair coin twice:

More information

Lecture 10. Variance and standard deviation

Lecture 10. Variance and standard deviation 18.440: Lecture 10 Variance and standard deviation Scott Sheffield MIT 1 Outline Defining variance Examples Properties Decomposition trick 2 Outline Defining variance Examples Properties Decomposition

More information

Why study probability? Set theory. ECE 6010 Lecture 1 Introduction; Review of Random Variables

Why study probability? Set theory. ECE 6010 Lecture 1 Introduction; Review of Random Variables ECE 6010 Lecture 1 Introduction; Review of Random Variables Readings from G&S: Chapter 1. Section 2.1, Section 2.3, Section 2.4, Section 3.1, Section 3.2, Section 3.5, Section 4.1, Section 4.2, Section

More information

Randomized algorithms. Inge Li Gørtz

Randomized algorithms. Inge Li Gørtz Randomized algorithms Inge Li Gørtz Randomized algorithms Today What are randomized algorithms? Properties of randomized algorithms Two examples: Median/Select. Quick-sort Randomized Algorithms Randomized

More information

2007 Winton. Empirical Distributions

2007 Winton. Empirical Distributions 1 Empirical Distributions 2 Distributions In the discrete case, a probability distribution is just a set of values, each with some probability of occurrence Probabilities don t change as values occur Example,

More information

Discrete-Event Simulation:

Discrete-Event Simulation: Discrete-Event Simulation: A First Course Section 2.4: Monte Carlo Simulation Examples Outline Matrices and Determinants Overview Matrices and Determinants Section 2.4: Monte Carlo Simulation Examples

More information