Simulation. Where real stuff starts

Size: px
Start display at page:

Download "Simulation. Where real stuff starts"

Transcription

1 1 Simulation Where real stuff starts

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

3 1. What is a simulation? 3

4 What is a simulation? An experiment in computer Important differences Simulated vs real time Serialization of events Initialization 4

5 5 Two simulation examples. What is the Simulation 1: Time to complete jobs customers arrive (at the same time) at Joe s shop and download a file. We want to estimate the time it takes to serve the customers difference? Simulation 2: Delay at a server An information server handles requests according to some scheduling policy. We want to estimate the time it takes to serve one request

6 Terminating versus non terminating simulation 6

7 7 Two Simulation Runs What is the difference? Scenario 1 Scenario 2 Average service time = 96 ms Average service time = 101 ms Request arrival rate = 100 /s

8 8 There is no stationary regime walk to infinity 10 /s Transient phase due to atypical initial conditions followed by typical (=stationary) phase You want to measure things only in the stationary phase Otherwise: non reproducible results, non typical

9 9 Definition of Stationarity A property of a stochastic model X t Let X t be a stochastic model that represents the state of the simulator at time t. It is stationary iff for any s>0 (X t1, X t2,, X tk ) has same distribution as (X t1+s, X t2+s,, X tk+s ) i.e. simulation does not get old

10 Classical Cases Markov models Definition: State X t is sufficient to draw the future of the simulation Common case for all simulations For a Markov model, over a discrete state space If you run the simulation long enough it will either walk to infinity (unstable) or converge to a stationary regime Ex: queue with >1: unstable queue with <1: becomes stationary after transient If the state space is strongly connected (any state can be reached from any state) then there is 0 or 1 stationary regime Ex: queue Else, there may be several distinct stationary regimes Ex: system with failure modes 10

11 Stationarity and Transience Knowing whether a model has a stationary regime is sometimes a hard problem We will see important models where this is solved Ex: some queuing systems Ex: time series models Reasoning about your system may give you indications Do you expect growth? Do you expect seasonality? Once you believe your model is stationary, you should handle transients in order to eliminate the impact of initial conditions Remove (how? Look at your output and guess) Sometimes it is possible to avoid transients at all (perfect simulation see later Importance of the View Point ) 11

12 Typical Reasons For Non Stationarity Obvious dependency on time Seasonality, growth Can be ignored at small time scale (minute) Non Stability: Explosion Queue with utilization factor >1 Non Stability: Freezing Simulation System becomes slower with time (aging) Typically because there are rare events of large impact («Kings») The longer the simulation, the larger the largest king We ll come back to this in the chapter «Importance of the View Point» 12

13 The state of a simulation at time is drawn at random from a distribution F(). Is this a stationary simulation? A. Yes B. It depends on the distribution is a sample drawn from the distribution 23, 100 C. It depends if the simulation terminates or not 56% D. No 26% E. I don t know 15% 4% 0% It depends on the distribut Yes It depends if the simulation No I don t know 13

14 14 Solution This simulation is stationary because the joint distribution of is the same for all It is the distribution of a vector of independent random variables drawn from is a sample drawn from the distribution 23, 100 It is statistically impossible to see whether a part of the simulation is young or old

15 15 2 Accuracy of Simulation Output A stochastic simulation produces a random output, we need confidence intervals 30 runs of Joe s shop: estimate the time to serve a batch of customers

16 16 Confidence Intervals Median Mean

17 When computing these confidence intervals we need to make sure that A. the simulation runs are independent B. the output is normally distributed 60% C. Both D. None 24% E. I don t know 16% 0% 0% the simulation runs are... the output is normally di... Both None I don t know 17

18 18 Solution If we use the median we need to ensure that the runs are independents If we use the mean we also need to ensure that the runs are independents that we are in the domain of validity of theorem which is probably OK when we will see a more formal answer next Answer A We will now see how to make sure simulation runs are independent

19 3 Random Number Generator A stochastic simulation does not use truly random numbers but use pseudo random numbers The Random Number Generator produces a random number U(0,1) based on a chaotic sequence Example (obsolete but commonly used, eg in ns2: ) Let us check if output looks random 19

20 20 The Linear Congruential Generator of ns2 uniform qq plot appears to be uniform autocorrelation Auto correlation is negligible

21 Lag Diagram, 1000 points 21 appears to be independent of

22 22 Period of RNG This RNG appears to produce an iid, uniform output However, it is in fact periodic Any sequence generated from a deterministic algorithm in a given computer must be periodic (because the number of states is finite) But we can require that the period should be much larger than maximum number of uses The ns2 simulator has period, which is too small The Mersenne twister (matlab s default) has period

23 23 Example when the period is too small Incorrect intervals (too large) Correct intervals

24 for two parallel streams with the ns2 RNG 24

25 Using RNGs Be careful to have a RNG that has a period orders of magnitude larger than what you will ever use in the simulation choose your RNG carefully The RNG must have a period several orders of magnitude larger than the maximum number of times you will call it The RNG uses a seed for independent replications you need independent seeds; sequential runs usually are sufficient. If you use parallel runs, you must find an way to obtain truly independent seeds Eg based on clock Or by using an RNG that supports parallel streams 25

26 26 4 Sampling From A Distribution Problem is: Given a distribution, and a RNG, produce some sample that is drawn from this distribution A common task in simulation Matlab does it for us most of the time, but not always Two generic methods CDF inversion Rejection sampling

27 CDF Inversion for distribution with CDF Applies to real or integer valued random variable For a continuous distribution: draw using RNG; then is drawn from the distribution with CDF CDF 27

28 28 Proof is uniformly distributed: for We define by, i.e. Let us compute the CDF of because is monotonic increasing Therefore

29 29

30 30 CDF Inversion, when has jumps Replace inverse by pseudo inverse CDF of an integer valued random variable

31 31 Sampling an integer valued RV We want to draw a sample of the random integer. Let for and such that 1. Draw using the RNG 2. Output is such that

32 32

33 33 What does this function compute? myfun if rand 0 else 1 A. The flip of a coin where 1 is obtained with proba and 0 with proba 1 B. The flip of a coin where 1 is obtained with proba 1 and 0 with proba C. A sample of a geometric random variable with mean D. A sample of a geometric random variable with mean E. I don t know The flip of a coin where 1 is... The flip of a coin where 1 is... 13% 71% A sample of a geometric r... A sample of a geometric ra... 17% 0% 0% I don t know

34 34 Solution The flip of a coin that returns 0 with probability follows If return 0 else return 1 is obtained as Answer B

35 Which one is a uniform random point? A. A B. B C. Both D. None E. I don t know A samples 64% B 16% 16% A B Both None 4% I don t know 0% 35

36 36 Solution A is a regular (non random) sample A B is sampled from the uniform distribution Answer B B

37 How do you sample a uniform point in a rectangle? 37

38 How do you sample a uniform point in a rectangle? where and are independent, because the distribution of given is uniform in (and therefore does not depend on do times Draw from the RNG end 38

39 We sample a point uniformly in some arbitrary area. Are and independent? A. Yes B. It depends on the area C. No D. I don t know 38% 38% 23% Yes It depends on the are No I don t know 0% 39

40 Solution When area is a rectangle, we have seen that the answer is yes For a general area, the distribution of given depends on Given Given are not independent 40

41 What is the PDF of the uniform distribution in?, if, if C. Something else D. I don t know 48% 32% 8% 12% 41 $$ $$,$$ $$,$$ = 1 if ($$, $$ $$,$$ $$,$$ = $$$$ if Something else I don t know

42 42 Solution Answer C The pdf is constant on (that is the definition of uniform) and 0 outside A but the constant is such that the total probability is 1, if

43 43 How can we sample a point uniformly distributed in this area? A B draw 10,20 if 0; 10 draw 20; 40 else draw 0; 20 repeat draw 10,20, 20; 40 until, A. A B. B C. Both D. None E. I don t know A 25% 38% B Both 38% None 0% I don t know 0%

44 44 Solution is not uniformly distributed. a higher chance of falling in A is wrong has

45 45 Solution B repeat draw 10,20, 20; 40 until, B first computes a point that is uniformly distributed and rejects it if it does not pass the test This is called rejection sampling It produces a sample of the conditional distribution of that (theorem 6.2 see later) given

46 46 Solution B produces a sample of the conditional distribution of given that What is this distribution?, Thus the pdf is,, i.e. the uniform distribution.

47 47 Rejection Sampling for Conditional Distribution Notation in this theorem Previous example, Unif rectangle), Unif rectangle), Unif A)

48 48 Recap A uniformly distributed point in an area A has pdf equal to,, It can be sampled by rejection sampling sample a point reject if not in until return uniform in a bounding box around Note: the distribution here is not the same as there

49 What does this algorithm compute? 1. sample uniformly in 10,10 ; 2. compute 3. with probability return with probability 1 goto 1 sin A. A sample of the random variable with pdf for some constant B. A sample of the random variable with pdf for some constant C. A sample of the random variable with pdf 1 for some constant D. Nothing, it never terminates E. None of the above F. I don t know A sample of the random var.. A sample of the random var.. 50% 14% A sample of the random var.. 9% Nothing, it never terminate 9% None of the above 14% I don t know 5% 49

50 50 Solution Intuitively, this algorithm chooses in with a probability proportional to Answer A is correct Formally, we will see the proof next. Note that the constant total probability =1, i.e. It is called a normalizing constant is given by the condition:

51 Rejection Sampling for General Distributions 51

52 Example: use rejection sampling to draw a sample of with pdf we take The rejection sampling algorithm is: 1. Sample and 2. If / return else goto 1 52

53 Are these algorithms equivalent when and? A. Yes B. No C. It depends D. I don t know A B 33% 38% 14% 14% Yes No It depends I don t know 53

54 54 Solution A B In Algorithm B, let Re write B as: 1. Sample uniformly in and ; 2. If return else goto 1 This is the same as Algorithm A Answer A is correct.

55 55

56 56 pdf histogram of samples obtained by rejection sampling

57 We sampled points from the distribution in with pdf Who s what? A. A 1, B 2, C 3 B. A 1, B 3, C 2 C. A 2, B 1, C 3 D. A 2, B 3, C 1 E. A 3, B 1, C 2 F. A 3, B 2, C 1 G. I don t know, 1,, % 14% 14% 14% 14% 14% 14% A 1, B 2, C 3 A 1, B 3, C 2 A 2, B 1, C 3 A 2, B 3, C 1 A 3, B 1, C 2 A 3, B 2, C 1 I don t know 57

58 58 Solution A is proportional to the distance from to the line B is uniform C is proportional to the distance from square to the center of the Answer F

59 Which algorithm is a correct sampling of the distribution in with pdf? A. A B. B C. Both D. None E. I don t know A B, Sample and uniformly in 0,1 and ~Unif 0, 2 ; 2. If, return, else goto 1 1. Sample and uniformly in 0,1 and ~Unif 0,1 ; 2. If, return, else goto 1 45% 36% 14% 5% 0% A B Both None I don t know 59

60 60 Solution Both are correct implementations of rejection sampling. We need where, for all Algorithm B is more efficient as it requires fewer iterations in average. An even more efficient implementation would sample U\simUnif(0, \sqrt(2)/2)u\simunif(0, \sqrt(2)/2)

61 61

62 Another Sample from a Weird Distribution 62

63 6.3 Ad Hoc Methods Optimized methods exist for some common distributions Optimization = reduce computing time If implemented in your tool, use them! Example: simulating a normal distribution Inversion method is not simple (no closed form for F 1 ) Rejection method is possible But a more efficient method exists, for drawing jointly 2 independent normal RVs There are also ad hoc methods for n dimensional normal distributions (gaussian vectors) 63

64 samples of the random Gaussian vector with zero mean and covariance matrix and are independent

65 samples of the random Gaussian vector with zero mean and covariance matrix are not independent

66 Non normal I don t know What is the distribution of? A. Normal with B. Normal with C. Normal but with other parameters D. Non normal E. I don t know 47% 26% 11% 16% 0% 66 Normal with $$=0,$$=0 Normal but with other par. Normal with $$=0,$$

67 67 Solution has a normal distribution (the marginal of a Gaussian random vector is Gaussian = normal) The mean is 0 because the mean of The variance is given by the covariance matrix and is 1. Answer 1

68 68 4 Monte Carlo Simulation A simple method to compute integrals and probabilities Idea: interpret the integral or probability and assume you can simulate as many independent samples of X as you want: 1. generate replicates 2. the Monte Carlo estimate of is 3. compute a confidence interval for the mean (since is the mean of the distribution of ) as

69 Example: Compute i.e. the average distance between two points uniformly distributed in the unit square 0 ; 1. Say which one is a correct implementation of the Monte-Carlo method: A 1. Draw points, random uniform in 0,1 2. mean,, 1: 3. std,, 1: A. A B. B C. Both D. None E. I don t know 0, 0 B do times sample (,,, ) iid Unif (0,1) end / 18% % 32% 5% 9% A B Both None I don t know 69

70 70 Solution Algorithms A and B compute the same and but algorithm A, line 4, uses a wrong formula for the confidence interval (it uses the formula for a prediction interval) Answer B

71 Compute Example i.e. the average distance between two points uniformly distributed in the unit square. We obtain the following Monte Carlo estimates R 95% confidence interval (The answer is known and is equal to [Ghosh B. 1943, On the distribution of random distances in a rectangle]) 71

72 Is it a good idea to use a confidence interval for the mean? A. Yes when is large B. Yes but it would be safer to use a CI for median C. No because we don t know if the output is normally distributed 68% D. I don t know 16% 11% 5% Yes when$$ is larg Yes but it would be safer t Nobecausewedon t kno I don t know 72

73 73 Solution We are estimating the mean of the distribution of we have no choice, we must use a CI for the mean therefore The formula is valid when is large, which is typically the case when we do a Monte Carlo simulation. Answer A

74 Conclusion Simulating well requires knowing the concepts of Transience Confidence intervals Sampling methods 74

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

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017 CPSC 531: System Modeling and Simulation Carey Williamson Department of Computer Science University of Calgary Fall 2017 Quote of the Day A person with one watch knows what time it is. A person with two

More information

Probability Models in Electrical and Computer Engineering Mathematical models as tools in analysis and design Deterministic models Probability models

Probability Models in Electrical and Computer Engineering Mathematical models as tools in analysis and design Deterministic models Probability models Probability Models in Electrical and Computer Engineering Mathematical models as tools in analysis and design Deterministic models Probability models Statistical regularity Properties of relative frequency

More information

EEC 686/785 Modeling & Performance Evaluation of Computer Systems. Lecture 19

EEC 686/785 Modeling & Performance Evaluation of Computer Systems. Lecture 19 EEC 686/785 Modeling & Performance Evaluation of Computer Systems Lecture 19 Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org (based on Dr. Raj Jain s lecture

More information

Chapter 11. Output Analysis for a Single Model Prof. Dr. Mesut Güneş Ch. 11 Output Analysis for a Single Model

Chapter 11. Output Analysis for a Single Model Prof. Dr. Mesut Güneş Ch. 11 Output Analysis for a Single Model Chapter Output Analysis for a Single Model. Contents Types of Simulation Stochastic Nature of Output Data Measures of Performance Output Analysis for Terminating Simulations Output Analysis for Steady-state

More information

Outline. Simulation of a Single-Server Queueing System. EEC 686/785 Modeling & Performance Evaluation of Computer Systems.

Outline. Simulation of a Single-Server Queueing System. EEC 686/785 Modeling & Performance Evaluation of Computer Systems. EEC 686/785 Modeling & Performance Evaluation of Computer Systems Lecture 19 Outline Simulation of a Single-Server Queueing System Review of midterm # Department of Electrical and Computer Engineering

More information

Computer Science, Informatik 4 Communication and Distributed Systems. Simulation. Discrete-Event System Simulation. Dr.

Computer Science, Informatik 4 Communication and Distributed Systems. Simulation. Discrete-Event System Simulation. Dr. Simulation Discrete-Event System Simulation Chapter 0 Output Analysis for a Single Model Purpose Objective: Estimate system performance via simulation If θ is the system performance, the precision of the

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

( ) ( ) Monte Carlo Methods Interested in. E f X = f x d x. Examples:

( ) ( ) Monte Carlo Methods Interested in. E f X = f x d x. Examples: Monte Carlo Methods Interested in Examples: µ E f X = f x d x Type I error rate of a hypothesis test Mean width of a confidence interval procedure Evaluating a likelihood Finding posterior mean and variance

More information

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

Random Processes. DS GA 1002 Probability and Statistics for Data Science. Random Processes DS GA 1002 Probability and Statistics for Data Science http://www.cims.nyu.edu/~cfgranda/pages/dsga1002_fall17 Carlos Fernandez-Granda Aim Modeling quantities that evolve in time (or space)

More information

Chapter 11 Output Analysis for a Single Model. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation

Chapter 11 Output Analysis for a Single Model. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation Chapter 11 Output Analysis for a Single Model Banks, Carson, Nelson & Nicol Discrete-Event System Simulation Purpose Objective: Estimate system performance via simulation If q is the system performance,

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

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems Exercises Solutions Note, that we have not formulated the answers for all the review questions. You will find the answers for many questions by reading and reflecting about the text in the book. Chapter

More information

ISyE 6644 Fall 2014 Test #2 Solutions (revised 11/7/16)

ISyE 6644 Fall 2014 Test #2 Solutions (revised 11/7/16) 1 NAME ISyE 6644 Fall 2014 Test #2 Solutions (revised 11/7/16) This test is 85 minutes. You are allowed two cheat sheets. Good luck! 1. Some short answer questions to get things going. (a) Consider the

More information

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.262 Discrete Stochastic Processes Midterm Quiz April 6, 2010 There are 5 questions, each with several parts.

More information

Slides 12: Output Analysis for a Single Model

Slides 12: Output Analysis for a Single Model Slides 12: Output Analysis for a Single Model Objective: Estimate system performance via simulation. If θ is the system performance, the precision of the estimator ˆθ can be measured by: The standard error

More information

Chapter 11 Estimation of Absolute Performance

Chapter 11 Estimation of Absolute Performance Chapter 11 Estimation of Absolute Performance Purpose Objective: Estimate system performance via simulation If q is the system performance, the precision of the estimator qˆ can be measured by: The standard

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

Stochastic Processes

Stochastic Processes Stochastic Processes Stochastic Process Non Formal Definition: Non formal: A stochastic process (random process) is the opposite of a deterministic process such as one defined by a differential equation.

More information

Lecture 2 Sep 5, 2017

Lecture 2 Sep 5, 2017 CS 388R: Randomized Algorithms Fall 2017 Lecture 2 Sep 5, 2017 Prof. Eric Price Scribe: V. Orestis Papadigenopoulos and Patrick Rall NOTE: THESE NOTES HAVE NOT BEEN EDITED OR CHECKED FOR CORRECTNESS 1

More information

The distribution inherited by Y is called the Cauchy distribution. Using that. d dy ln(1 + y2 ) = 1 arctan(y)

The distribution inherited by Y is called the Cauchy distribution. Using that. d dy ln(1 + y2 ) = 1 arctan(y) Stochastic Processes - MM3 - Solutions MM3 - Review Exercise Let X N (0, ), i.e. X is a standard Gaussian/normal random variable, and denote by f X the pdf of X. Consider also a continuous random variable

More information

ISyE 6644 Fall 2014 Test 3 Solutions

ISyE 6644 Fall 2014 Test 3 Solutions 1 NAME ISyE 6644 Fall 14 Test 3 Solutions revised 8/4/18 You have 1 minutes for this test. You are allowed three cheat sheets. Circle all final answers. Good luck! 1. [4 points] Suppose that the joint

More information

Random Number Generation. Stephen Booth David Henty

Random Number Generation. Stephen Booth David Henty Random Number Generation Stephen Booth David Henty Introduction Random numbers are frequently used in many types of computer simulation Frequently as part of a sampling process: Generate a representative

More information

Network Simulation Chapter 6: Output Data Analysis

Network Simulation Chapter 6: Output Data Analysis Network Simulation Chapter 6: Output Data Analysis Prof. Dr. Jürgen Jasperneite 1 Contents Introduction Types of simulation output Transient detection When to terminate a simulation 2 Prof. Dr. J ürgen

More information

Econ 424 Time Series Concepts

Econ 424 Time Series Concepts Econ 424 Time Series Concepts Eric Zivot January 20 2015 Time Series Processes Stochastic (Random) Process { 1 2 +1 } = { } = sequence of random variables indexed by time Observed time series of length

More information

LECTURES 2-3 : Stochastic Processes, Autocorrelation function. Stationarity.

LECTURES 2-3 : Stochastic Processes, Autocorrelation function. Stationarity. LECTURES 2-3 : Stochastic Processes, Autocorrelation function. Stationarity. Important points of Lecture 1: A time series {X t } is a series of observations taken sequentially over time: x t is an observation

More information

Monte Carlo Simulation. CWR 6536 Stochastic Subsurface Hydrology

Monte Carlo Simulation. CWR 6536 Stochastic Subsurface Hydrology Monte Carlo Simulation CWR 6536 Stochastic Subsurface Hydrology Steps in Monte Carlo Simulation Create input sample space with known distribution, e.g. ensemble of all possible combinations of v, D, q,

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

Computational statistics

Computational statistics Computational statistics Markov Chain Monte Carlo methods Thierry Denœux March 2017 Thierry Denœux Computational statistics March 2017 1 / 71 Contents of this chapter When a target density f can be evaluated

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

Output Data Analysis for a Single System

Output Data Analysis for a Single System Output Data Analysis for a Single System Chapter 9 Based on the slides provided with the textbook 2 9.1 Introduction Output data analysis is often not conducted appropriately Treating output of a single

More information

14 Random Variables and Simulation

14 Random Variables and Simulation 14 Random Variables and Simulation In this lecture note we consider the relationship between random variables and simulation models. Random variables play two important roles in simulation models. We assume

More information

7 Variance Reduction Techniques

7 Variance Reduction Techniques 7 Variance Reduction Techniques In a simulation study, we are interested in one or more performance measures for some stochastic model. For example, we want to determine the long-run average waiting time,

More information

More on Input Distributions

More on Input Distributions More on Input Distributions Importance of Using the Correct Distribution Replacing a distribution with its mean Arrivals Waiting line Processing order System Service mean interarrival time = 1 minute mean

More information

Review. DS GA 1002 Statistical and Mathematical Models. Carlos Fernandez-Granda

Review. DS GA 1002 Statistical and Mathematical Models.   Carlos Fernandez-Granda Review DS GA 1002 Statistical and Mathematical Models http://www.cims.nyu.edu/~cfgranda/pages/dsga1002_fall16 Carlos Fernandez-Granda Probability and statistics Probability: Framework for dealing with

More information

An MCMC Package for R

An MCMC Package for R An MCMC Package for R Charles J. Geyer August 28, 2009 1 Introduction This package is a simple first attempt at a sensible general MCMC package. It doesn t do much yet. It only does normal random-walk

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

16 : Markov Chain Monte Carlo (MCMC)

16 : Markov Chain Monte Carlo (MCMC) 10-708: Probabilistic Graphical Models 10-708, Spring 2014 16 : Markov Chain Monte Carlo MCMC Lecturer: Matthew Gormley Scribes: Yining Wang, Renato Negrinho 1 Sampling from low-dimensional distributions

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

1.225J J (ESD 205) Transportation Flow Systems

1.225J J (ESD 205) Transportation Flow Systems 1.225J J (ESD 25) Transportation Flow Systems Lecture 9 Simulation Models Prof. Ismail Chabini and Prof. Amedeo R. Odoni Lecture 9 Outline About this lecture: It is based on R16. Only material covered

More information

Probability and Statistics Concepts

Probability and Statistics Concepts University of Central Florida Computer Science Division COT 5611 - Operating Systems. Spring 014 - dcm Probability and Statistics Concepts Random Variable: a rule that assigns a numerical value to each

More information

Overview of Spatial analysis in ecology

Overview of Spatial analysis in ecology Spatial Point Patterns & Complete Spatial Randomness - II Geog 0C Introduction to Spatial Data Analysis Chris Funk Lecture 8 Overview of Spatial analysis in ecology st step in understanding ecological

More information

Variance reduction techniques

Variance reduction techniques Variance reduction techniques Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/kurssit/elt-53606/ OUTLINE: Simulation with a given accuracy; Variance reduction techniques;

More information

STA205 Probability: Week 8 R. Wolpert

STA205 Probability: Week 8 R. Wolpert INFINITE COIN-TOSS AND THE LAWS OF LARGE NUMBERS The traditional interpretation of the probability of an event E is its asymptotic frequency: the limit as n of the fraction of n repeated, similar, and

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

Lehmer Random Number Generators: Introduction

Lehmer Random Number Generators: Introduction Lehmer Random Number Generators: Introduction Revised version of the slides based on the book Discrete-Event Simulation: a first course LL Leemis & SK Park Section(s) 21, 22 c 2006 Pearson Ed, Inc 0-13-142917-5

More information

2008 Winton. Statistical Testing of RNGs

2008 Winton. Statistical Testing of RNGs 1 Statistical Testing of RNGs Criteria for Randomness For a sequence of numbers to be considered a sequence of randomly acquired numbers, it must have two basic statistical properties: Uniformly distributed

More information

EE/PEP 345. Modeling and Simulation. Spring Class 11

EE/PEP 345. Modeling and Simulation. Spring Class 11 EE/PEP 345 Modeling and Simulation Class 11 11-1 Output Analysis for a Single Model Performance measures System being simulated Output Output analysis Stochastic character Types of simulations Output analysis

More information

11. Further Issues in Using OLS with TS Data

11. Further Issues in Using OLS with TS Data 11. Further Issues in Using OLS with TS Data With TS, including lags of the dependent variable often allow us to fit much better the variation in y Exact distribution theory is rarely available in TS applications,

More information

MATH5835 Statistical Computing. Jochen Voss

MATH5835 Statistical Computing. Jochen Voss MATH5835 Statistical Computing Jochen Voss September 27, 2011 Copyright c 2011 Jochen Voss J.Voss@leeds.ac.uk This text is work in progress and may still contain typographical and factual mistakes. Reports

More information

EE/CpE 345. Modeling and Simulation. Fall Class 5 September 30, 2002

EE/CpE 345. Modeling and Simulation. Fall Class 5 September 30, 2002 EE/CpE 345 Modeling and Simulation Class 5 September 30, 2002 Statistical Models in Simulation Real World phenomena of interest Sample phenomena select distribution Probabilistic, not deterministic Model

More information

Overall Plan of Simulation and Modeling I. Chapters

Overall Plan of Simulation and Modeling I. Chapters Overall Plan of Simulation and Modeling I Chapters Introduction to Simulation Discrete Simulation Analytical Modeling Modeling Paradigms Input Modeling Random Number Generation Output Analysis Continuous

More information

18.05 Practice Final Exam

18.05 Practice Final Exam No calculators. 18.05 Practice Final Exam Number of problems 16 concept questions, 16 problems. Simplifying expressions Unless asked to explicitly, you don t need to simplify complicated expressions. For

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

ACM 116: Lectures 3 4

ACM 116: Lectures 3 4 1 ACM 116: Lectures 3 4 Joint distributions The multivariate normal distribution Conditional distributions Independent random variables Conditional distributions and Monte Carlo: Rejection sampling Variance

More information

Variance reduction techniques

Variance reduction techniques Variance reduction techniques Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/ moltchan/modsim/ http://www.cs.tut.fi/kurssit/tlt-2706/ OUTLINE: Simulation with a given confidence;

More information

TAKEHOME FINAL EXAM e iω e 2iω e iω e 2iω

TAKEHOME FINAL EXAM e iω e 2iω e iω e 2iω ECO 513 Spring 2015 TAKEHOME FINAL EXAM (1) Suppose the univariate stochastic process y is ARMA(2,2) of the following form: y t = 1.6974y t 1.9604y t 2 + ε t 1.6628ε t 1 +.9216ε t 2, (1) where ε is i.i.d.

More information

Workshop on Heterogeneous Computing, 16-20, July No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo

Workshop on Heterogeneous Computing, 16-20, July No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo Workshop on Heterogeneous Computing, 16-20, July 2012 No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo K. P. N. Murthy School of Physics, University of Hyderabad July 19, 2012 K P N Murthy

More information

Robert Collins CSE586, PSU Intro to Sampling Methods

Robert Collins CSE586, PSU Intro to Sampling Methods Intro to Sampling Methods CSE586 Computer Vision II Penn State Univ Topics to be Covered Monte Carlo Integration Sampling and Expected Values Inverse Transform Sampling (CDF) Ancestral Sampling Rejection

More information

Section 2: Estimation, Confidence Intervals and Testing Hypothesis

Section 2: Estimation, Confidence Intervals and Testing Hypothesis Section 2: Estimation, Confidence Intervals and Testing Hypothesis Carlos M. Carvalho The University of Texas at Austin McCombs School of Business http://faculty.mccombs.utexas.edu/carlos.carvalho/teaching/

More information

Midterm Exam 1 (Solutions)

Midterm Exam 1 (Solutions) EECS 6 Probability and Random Processes University of California, Berkeley: Spring 07 Kannan Ramchandran February 3, 07 Midterm Exam (Solutions) Last name First name SID Name of student on your left: Name

More information

ECE Lecture 4. Overview Simulation & MATLAB

ECE Lecture 4. Overview Simulation & MATLAB ECE 450 - Lecture 4 Overview Simulation & MATLAB Random Variables: Concept and Definition Cumulative Distribution Functions (CDF s) Eamples & Properties Probability Distribution Functions (pdf s) 1 Random

More information

Lecture 6: Markov Chain Monte Carlo

Lecture 6: Markov Chain Monte Carlo Lecture 6: Markov Chain Monte Carlo D. Jason Koskinen koskinen@nbi.ku.dk Photo by Howard Jackman University of Copenhagen Advanced Methods in Applied Statistics Feb - Apr 2016 Niels Bohr Institute 2 Outline

More information

Name of the Student:

Name of the Student: SUBJECT NAME : Probability & Queueing Theory SUBJECT CODE : MA 6453 MATERIAL NAME : Part A questions REGULATION : R2013 UPDATED ON : November 2017 (Upto N/D 2017 QP) (Scan the above QR code for the direct

More information

Class 26: review for final exam 18.05, Spring 2014

Class 26: review for final exam 18.05, Spring 2014 Probability Class 26: review for final eam 8.05, Spring 204 Counting Sets Inclusion-eclusion principle Rule of product (multiplication rule) Permutation and combinations Basics Outcome, sample space, event

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

Chapter 10 Verification and Validation of Simulation Models. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation

Chapter 10 Verification and Validation of Simulation Models. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation Chapter 10 Verification and Validation of Simulation Models Banks, Carson, Nelson & Nicol Discrete-Event System Simulation Purpose & Overview The goal of the validation process is: To produce a model that

More information

Lecture Notes 5 Convergence and Limit Theorems. Convergence with Probability 1. Convergence in Mean Square. Convergence in Probability, WLLN

Lecture Notes 5 Convergence and Limit Theorems. Convergence with Probability 1. Convergence in Mean Square. Convergence in Probability, WLLN Lecture Notes 5 Convergence and Limit Theorems Motivation Convergence with Probability Convergence in Mean Square Convergence in Probability, WLLN Convergence in Distribution, CLT EE 278: Convergence and

More information

Quiz 1. Name: Instructions: Closed book, notes, and no electronic devices.

Quiz 1. Name: Instructions: Closed book, notes, and no electronic devices. Quiz 1. Name: Instructions: Closed book, notes, and no electronic devices. 1. What is the difference between a deterministic model and a probabilistic model? (Two or three sentences only). 2. What is the

More information

Exercises Stochastic Performance Modelling. Hamilton Institute, Summer 2010

Exercises Stochastic Performance Modelling. Hamilton Institute, Summer 2010 Exercises Stochastic Performance Modelling Hamilton Institute, Summer Instruction Exercise Let X be a non-negative random variable with E[X ]

More information

Generating Uniform Random Numbers

Generating Uniform Random Numbers 1 / 43 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA March 1, 2016 2 / 43 Outline 1 Introduction 2 Some Generators We Won t

More information

Practical Statistics

Practical Statistics Practical Statistics Lecture 1 (Nov. 9): - Correlation - Hypothesis Testing Lecture 2 (Nov. 16): - Error Estimation - Bayesian Analysis - Rejecting Outliers Lecture 3 (Nov. 18) - Monte Carlo Modeling -

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

ST 740: Markov Chain Monte Carlo

ST 740: Markov Chain Monte Carlo ST 740: Markov Chain Monte Carlo Alyson Wilson Department of Statistics North Carolina State University October 14, 2012 A. Wilson (NCSU Stsatistics) MCMC October 14, 2012 1 / 20 Convergence Diagnostics:

More information

ECO 513 Fall 2009 C. Sims HIDDEN MARKOV CHAIN MODELS

ECO 513 Fall 2009 C. Sims HIDDEN MARKOV CHAIN MODELS ECO 513 Fall 2009 C. Sims HIDDEN MARKOV CHAIN MODELS 1. THE CLASS OF MODELS y t {y s, s < t} p(y t θ t, {y s, s < t}) θ t = θ(s t ) P[S t = i S t 1 = j] = h ij. 2. WHAT S HANDY ABOUT IT Evaluating the

More information

Covers Chapter 10-12, some of 16, some of 18 in Wooldridge. Regression Analysis with Time Series Data

Covers Chapter 10-12, some of 16, some of 18 in Wooldridge. Regression Analysis with Time Series Data Covers Chapter 10-12, some of 16, some of 18 in Wooldridge Regression Analysis with Time Series Data Obviously time series data different from cross section in terms of source of variation in x and y temporal

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

1 Random walks and data

1 Random walks and data Inference, Models and Simulation for Complex Systems CSCI 7-1 Lecture 7 15 September 11 Prof. Aaron Clauset 1 Random walks and data Supposeyou have some time-series data x 1,x,x 3,...,x T and you want

More information

ISE/OR 762 Stochastic Simulation Techniques

ISE/OR 762 Stochastic Simulation Techniques ISE/OR 762 Stochastic Simulation Techniques Topic 0: Introduction to Discrete Event Simulation Yunan Liu Department of Industrial and Systems Engineering NC State University January 9, 2018 Yunan Liu (NC

More information

On the Partitioning of Servers in Queueing Systems during Rush Hour

On the Partitioning of Servers in Queueing Systems during Rush Hour On the Partitioning of Servers in Queueing Systems during Rush Hour This paper is motivated by two phenomena observed in many queueing systems in practice. The first is the partitioning of server capacity

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 LIST OF TABLES... LIST OF FIGURES... xvii. LIST OF LISTINGS... xxi PREFACE. ...xxiii

Contents LIST OF TABLES... LIST OF FIGURES... xvii. LIST OF LISTINGS... xxi PREFACE. ...xxiii LIST OF TABLES... xv LIST OF FIGURES... xvii LIST OF LISTINGS... xxi PREFACE...xxiii CHAPTER 1. PERFORMANCE EVALUATION... 1 1.1. Performance evaluation... 1 1.2. Performance versus resources provisioning...

More information

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006 Astronomical p( y x, I) p( x, I) p ( x y, I) = p( y, I) Data Analysis I Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK 10 lectures, beginning October 2006 4. Monte Carlo Methods

More information

Bulk input queue M [X] /M/1 Bulk service queue M/M [Y] /1 Erlangian queue M/E k /1

Bulk input queue M [X] /M/1 Bulk service queue M/M [Y] /1 Erlangian queue M/E k /1 Advanced Markovian queues Bulk input queue M [X] /M/ Bulk service queue M/M [Y] / Erlangian queue M/E k / Bulk input queue M [X] /M/ Batch arrival, Poisson process, arrival rate λ number of customers in

More information

Chapter 2 SIMULATION BASICS. 1. Chapter Overview. 2. Introduction

Chapter 2 SIMULATION BASICS. 1. Chapter Overview. 2. Introduction Chapter 2 SIMULATION BASICS 1. Chapter Overview This chapter has been written to introduce the topic of discreteevent simulation. To comprehend the material presented in this chapter, some background in

More information

CSC 2541: Bayesian Methods for Machine Learning

CSC 2541: Bayesian Methods for Machine Learning CSC 2541: Bayesian Methods for Machine Learning Radford M. Neal, University of Toronto, 2011 Lecture 3 More Markov Chain Monte Carlo Methods The Metropolis algorithm isn t the only way to do MCMC. We ll

More information

B. Maddah ENMG 622 Simulation 11/11/08

B. Maddah ENMG 622 Simulation 11/11/08 B. Maddah ENMG 622 Simulation 11/11/08 Random-Number Generators (Chapter 7, Law) Overview All stochastic simulations need to generate IID uniformly distributed on (0,1), U(0,1), random numbers. 1 f X (

More information

CS145: Probability & Computing Lecture 24: Algorithms

CS145: Probability & Computing Lecture 24: Algorithms CS145: Probability & Computing Lecture 24: Algorithms Instructor: Eli Upfal Brown University Computer Science Figure credits: Bertsekas & Tsitsiklis, Introduction to Probability, 2008 Pitman, Probability,

More information

Sources of randomness

Sources of randomness Random Number Generator Chapter 7 In simulations, we generate random values for variables with a specified distribution Ex., model service times using the exponential distribution Generation of random

More information

L09. PARTICLE FILTERING. NA568 Mobile Robotics: Methods & Algorithms

L09. PARTICLE FILTERING. NA568 Mobile Robotics: Methods & Algorithms L09. PARTICLE FILTERING NA568 Mobile Robotics: Methods & Algorithms Particle Filters Different approach to state estimation Instead of parametric description of state (and uncertainty), use a set of state

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

Eco517 Fall 2004 C. Sims MIDTERM EXAM

Eco517 Fall 2004 C. Sims MIDTERM EXAM Eco517 Fall 2004 C. Sims MIDTERM EXAM Answer all four questions. Each is worth 23 points. Do not devote disproportionate time to any one question unless you have answered all the others. (1) We are considering

More information

Simulation optimization via bootstrapped Kriging: Survey

Simulation optimization via bootstrapped Kriging: Survey Simulation optimization via bootstrapped Kriging: Survey Jack P.C. Kleijnen Department of Information Management / Center for Economic Research (CentER) Tilburg School of Economics & Management (TiSEM)

More information

IE 303 Discrete-Event Simulation L E C T U R E 6 : R A N D O M N U M B E R G E N E R A T I O N

IE 303 Discrete-Event Simulation L E C T U R E 6 : R A N D O M N U M B E R G E N E R A T I O N IE 303 Discrete-Event Simulation L E C T U R E 6 : R A N D O M N U M B E R G E N E R A T I O N Review of the Last Lecture Continuous Distributions Uniform distributions Exponential distributions and memoryless

More information

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.262 Discrete Stochastic Processes Midterm Quiz April 6, 2010 There are 5 questions, each with several parts.

More information

CPSC 531 Systems Modeling and Simulation FINAL EXAM

CPSC 531 Systems Modeling and Simulation FINAL EXAM CPSC 531 Systems Modeling and Simulation FINAL EXAM Department of Computer Science University of Calgary Professor: Carey Williamson December 21, 2017 This is a CLOSED BOOK exam. Textbooks, notes, laptops,

More information

Massachusetts Institute of Technology

Massachusetts Institute of Technology .203J/6.28J/3.665J/5.073J/6.76J/ESD.26J Quiz Solutions (a)(i) Without loss of generality we can pin down X at any fixed point. X 2 is still uniformly distributed over the square. Assuming that the police

More information

18.05 Final Exam. Good luck! Name. No calculators. Number of problems 16 concept questions, 16 problems, 21 pages

18.05 Final Exam. Good luck! Name. No calculators. Number of problems 16 concept questions, 16 problems, 21 pages Name No calculators. 18.05 Final Exam Number of problems 16 concept questions, 16 problems, 21 pages Extra paper If you need more space we will provide some blank paper. Indicate clearly that your solution

More information

Seminar on Simulation of Telecommunication Sistems

Seminar on Simulation of Telecommunication Sistems Politecnico di Milano Dipartimento di Elettronica e Informazione Seminar on Simulation of Telecommunication Sistems Massimo Tornatore Francesco Musumeci (Author of the original slides: Fabio Martignon)

More information

DS-GA 1003: Machine Learning and Computational Statistics Homework 7: Bayesian Modeling

DS-GA 1003: Machine Learning and Computational Statistics Homework 7: Bayesian Modeling DS-GA 1003: Machine Learning and Computational Statistics Homework 7: Bayesian Modeling Due: Tuesday, May 10, 2016, at 6pm (Submit via NYU Classes) Instructions: Your answers to the questions below, including

More information