Random Variate Generation (Part 3)



Similar documents
2WB05 Simulation Lecture 8: Generating random variables

Introduction to Probability

Chapter 3 RANDOM VARIATE GENERATION

Joint Exam 1/P Sample Exam 1

UNIT I: RANDOM VARIABLES PART- A -TWO MARKS

Notes on Continuous Random Variables

Choosing Probability Distributions in Simulation

General Sampling Methods

Probability and statistics; Rehearsal for pattern recognition

Math 461 Fall 2006 Test 2 Solutions

Homework # 3 Solutions

Algebra I Vocabulary Cards

Monte Carlo Sampling Methods

Introduction to Mobile Robotics Bayes Filter Particle Filter and Monte Carlo Localization

Generating Random Numbers Variance Reduction Quasi-Monte Carlo. Simulation Methods. Leonid Kogan. MIT, Sloan , Fall 2010

Supplement to Call Centers with Delay Information: Models and Insights

Institute of Actuaries of India Subject CT3 Probability and Mathematical Statistics

Chapter 4 Lecture Notes

Lecture 8. Generating a non-uniform probability distribution

Master s Theory Exam Spring 2006

Important Probability Distributions OPRE 6301

Department of Mathematics, Indian Institute of Technology, Kharagpur Assignment 2-3, Probability and Statistics, March Due:-March 25, 2015.

Overview of Monte Carlo Simulation, Probability Review and Introduction to Matlab

5. Continuous Random Variables

Probability density function : An arbitrary continuous random variable X is similarly described by its probability density function f x = f X

LECTURE 16. Readings: Section 5.1. Lecture outline. Random processes Definition of the Bernoulli process Basic properties of the Bernoulli process

Statistics I for QBIC. Contents and Objectives. Chapters 1 7. Revised: August 2013

CORRELATED TO THE SOUTH CAROLINA COLLEGE AND CAREER-READY FOUNDATIONS IN ALGEBRA

A Simple Pseudo Random Number algorithm

( ) = 1 x. ! 2x = 2. The region where that joint density is positive is indicated with dotted lines in the graph below. y = x

Lecture 7: Continuous Random Variables

6 Scalar, Stochastic, Discrete Dynamic Systems

BNG 202 Biomechanics Lab. Descriptive statistics and probability distributions I

Generating Random Variables and Stochastic Processes

Summary of Formulas and Concepts. Descriptive Statistics (Ch. 1-4)

LOGNORMAL MODEL FOR STOCK PRICES

The Variability of P-Values. Summary

Stochastic Processes and Queueing Theory used in Cloud Computer Performance Simulations

Exploratory Data Analysis

Sums of Independent Random Variables

Probability and Statistics Vocabulary List (Definitions for Middle School Teachers)

e.g. arrival of a customer to a service station or breakdown of a component in some system.

Math 370, Spring 2008 Prof. A.J. Hildebrand. Practice Test 1 Solutions

Recursive Estimation


Chapter 4. Probability Distributions

Transformations and Expectations of random variables

Probability and Statistics Prof. Dr. Somesh Kumar Department of Mathematics Indian Institute of Technology, Kharagpur

Nonparametric adaptive age replacement with a one-cycle criterion

Generating Random Variables and Stochastic Processes

seven Statistical Analysis with Excel chapter OVERVIEW CHAPTER

THE CENTRAL LIMIT THEOREM TORONTO

Quantum Computing Lecture 7. Quantum Factoring. Anuj Dawar

Probability for Estimation (review)

Homework 4 - KEY. Jeff Brenion. June 16, Note: Many problems can be solved in more than one way; we present only a single solution here.

FEGYVERNEKI SÁNDOR, PROBABILITY THEORY AND MATHEmATICAL

A Model of Optimum Tariff in Vehicle Fleet Insurance

How to Gamble If You Must

Data Mining: Algorithms and Applications Matrix Math Review

MATH 095, College Prep Mathematics: Unit Coverage Pre-algebra topics (arithmetic skills) offered through BSE (Basic Skills Education)

WEEK #22: PDFs and CDFs, Measures of Center and Spread

TEACHING SIMULATION WITH SPREADSHEETS

The Cumulative Distribution and Stochastic Dominance

Chapter 3: DISCRETE RANDOM VARIABLES AND PROBABILITY DISTRIBUTIONS. Part 3: Discrete Uniform Distribution Binomial Distribution

Higher Education Math Placement

6 PROBABILITY GENERATING FUNCTIONS

Some Lecture Notes and In-Class Examples for Pre-Calculus:

The sample space for a pair of die rolls is the set. The sample space for a random number between 0 and 1 is the interval [0, 1].

Discrete Optimization

2.1 Increasing, Decreasing, and Piecewise Functions; Applications

Monte Carlo Methods in Finance

For a partition B 1,..., B n, where B i B j = for i. A = (A B 1 ) (A B 2 ),..., (A B n ) and thus. P (A) = P (A B i ) = P (A B i )P (B i )

Triangular Distributions

VISUALIZATION OF DENSITY FUNCTIONS WITH GEOGEBRA

Selecting the Right Distribution

Review of Random Variables

What is Statistics? Lecture 1. Introduction and probability review. Idea of parametric inference

Solving Linear Systems, Continued and The Inverse of a Matrix

1 Simulating Brownian motion (BM) and geometric Brownian motion (GBM)

CA200 Quantitative Analysis for Business Decisions. File name: CA200_Section_04A_StatisticsIntroduction

Point Biserial Correlation Tests

Chapter 5. Random variables

APPLIED MATHEMATICS ADVANCED LEVEL

( ) is proportional to ( 10 + x)!2. Calculate the

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics

Microeconomic Theory: Basic Math Concepts

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

SAT Subject Math Level 2 Facts & Formulas

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Week 2: Exponential Functions

Ex. 2.1 (Davide Basilio Bartolini)

Math 425 (Fall 08) Solutions Midterm 2 November 6, 2008

Online EFFECTIVE AS OF JANUARY 2013

YASAIw.xla A modified version of an open source add in for Excel to provide additional functions for Monte Carlo simulation.

Evaluating the Lead Time Demand Distribution for (r, Q) Policies Under Intermittent Demand

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

How To Solve A Sequential Mca Problem

Transcription:

Random Variate Generation (Part 3) Dr.Çağatay ÜNDEĞER Öğretim Görevlisi Bilkent Üniversitesi Bilgisayar Mühendisliği Bölümü &... e-mail : cagatay@undeger.com cagatay@cs.bilkent.edu.tr Bilgisayar Mühendisliği Bölümü Bilkent Üniversitesi Fall 2008 1 Random Variate Generation (Outline) Random numbers Random number generators Random variate generation Factors to be considered General principles Inverse Transform Method Acceptance-Rejection Method Composition Method Relocate and Rescale Method Specific distributions 2 1

Random Numbers A random sequence of numbers obtained from a stochastic process. In real world, random numbers may be generated using a dice or a roulette wheel. 3 Random Numbers Random numbers are very important for a simulation, Since all the randomness required by the model is simulated by a random number generator, Whose output is assumed to be a sequence of independent and identically (uniformly) distributed random numbers between 0 and 1. Then these random numbers are transformed into required probability distributions. 4 2

Random Number Generator A computational or physical device designed to generate a sequence of numbers that lack any pattern (i.e. appear random). 5 Random Number Generators Computer-based generators are simple deterministic programs trying to fool the user by producing a deterministic squence that looks random (pseudo random numbers). Therefore, they should meet some statistical tests for randomness intended to ensure that they do not have any easily discernible patterns. 6 3

Random Number Seed Computer-based generators use random number seeds for seting the starting point of the random number squence. These seeds are often initialized using a computer's real time clock in order to have some external noise. Pseudo random number squence Seed 7 Random Variate Generation Refers to the generation of variates whose probability distribution is different from the uniform distribution on the interval (0,1). 8 4

Factors to Be Considered Exactness: Exact if distribution of variates generated has the exact form desired. Speed: Related with computing time required to generate variate. Contributions to time are: Setup time, Variable generation time. 9 Factors to Be Considered Space: Computer memory required for the generator. Simplicity: Refers to both algorithmic simplicity and implementation simplicity. 10 5

General Principles We assume that a pseudo random number generator RN(0,1) producing a sequence of independent between 0 and 1 is available. General methods: Inverse transform method Acceptance-rejection method Composite method Translations and other simple transforms 11 Inverse Transform Method A continuous distribution can be defined by its density function f(x). The probability that a value x lies between a and b, where a>b, is the integral of function between a and b. density (probability) P(a x b) = f(x) dx b a the area between a and b - + a b x 12 6

Inverse Transform Method The cummulative distribution function can be generated for all x by computing the integral of function between -infinite and x. density f(x) F(x) = - f(z) dz x - + x cummulative probability 1 F(x) 0 - + x 13 Inverse Transform Method Function is strictly increasing and contiuous. F(x) = u gives a unique x. u cummulative probability 1 F(x) 0 - + x x = F -1 (u) inverse of F(x) 14 7

Inverse Transform Method For generating random variates with f(x): Let u = RN(0,1) Return x = F -1 (u) cummulative probability A random number in range [0,1] u 1 F(x) 0 x + 15 Inverse Transform Method (Sample) For exponential distribution: Probability density function Cummulative distribution function x = F -1 (x,λ) = -ln(1-u)/λ 16 8

Acceptance-Rejection Method Suppose that we need to sample from a distribution whose inverse function is hard to solve. In that case, acceptance-rejection method can be used. 17 Acceptance-Rejection Method Generate a random point (X,Y) on the graph. If (X,Y) lies under the graph of f(x) then Accept X Otherwise Reject X An accepted point probability X A rejected point Y - + 0,0 18 9

Acceptance-Rejection Method (Drawback) Trials ratio: Average number of points (X,Y) needed to produce one accepted X. We need to make trial ratio close to 1. Else generator may not be efficient enough because of wasted computating effort. 19 Acceptance-Rejection Method (Making More Efficient) One way to make generator efficient is; To generate points uniformly scattered under a function e(x), where area between the graph of f and e be small. probability f(x) e(x) - + a b 20 10

Acceptance-Rejection Method (Constructing e(x)) Take e(x) = Kg(x) g(x) = density function of a distribution for which an easy way of generating variates already exists. K = scale factor probability K scales g(x) Kg(x) g(x) - + 21 Acceptance-Rejection Method (Producing (X,Y)) Let X = a variate produced from Kg(x) Let U = RN(0,1) (X,Y) = (X, UKg(X)) probability Kg(x) U locates Y randomly under Kg(x) Kg(x) Y = UKg(x) (X,Y) - + X 22 11

Composition Method Soppose that density f is written as weighted sum of r other density functions (f i ), Where weights (p i ) satisfy: All p i > 0 Sum of all p i = 1 A mixture or a compound density f(x) = r p i f i (x) i = 1 23 Let U = RN(0,1) Set i = 1 Composition Method (Producing Variates) While ( F i < U ), where F i = p k k = 1 i = i+1 Return X = a variate produced from f i i p 1 p 2 p 3 p 4 0 1 U selects one of the densities randomly 24 12

Relocate and Rescale Method If X is a random variate drawn from a continuous distribution f(x), We can reposition and rescale the distribution to get a random variate Y. Y = ax + b rescale relocate probability relocated f(x) rescaled - + b 25 Bernoulli Distributions Density: Value 1 with success probability p, and Value 0 with failure probability q = 1 p. Random variate production: Let U = RN(0,1) If (U p) Return X = 1 Else Return X = 0 26 13

Density: Uniform Distributions Values between a and b, where a>b, and probabilities of all the are equal. Production (relocate & rescale): Let U = RN(0,1) Return X = a + (b-a)u Probability for discrete : a + min( int[(b-a+1)u], b-a ) p a b 27 Triangular Distributions Density: A distribution with lower limit a, mode c, and upper limit b. Production (inverse transform, relocate & rescale): Let β = (c-a)/(b-a) Let U 1 = RN(0,1), U 2 = RN(0,1) If (U 1 β) Probability Return X = a + (c-a) U 2 2/(b-a) Else Return X = b - (b-c) U 2 a c b 28 14

Density: Symmetric Triangular Distributions A triangular distribution with c located at the center of a and b. Production (probability theory): If U 1 and U 2 are uniformly distributed between 0 and 1 then (U 1 +U 2 )/2 has a symmetric triangular distribution between 0 and 1. 29 Density: Symmetric Triangular Distributions A triangular distribution with c located at the center of a and b. Production (probability t., relocate & rescale): Let U 1 = RN(0,1), U 2 = RN(0,1) Return X = a + (b-a)(u 1 +U 2 )/2 Probability 2/(b-a) a c b 30 15

Normal (Gaussian) Distributions Density: A bell-like shaped function with µ and σ. Production (special transform): While (true) Let U 1 = RN(0,1), U 2 = RN(0,1) Let V 1 = 2U 1-1, V 2 = 2U 2-1 Let W = V 12 +V 2 2 If (W<1) Let Y = (-2lnW)/W Return X = µ + σv 1 Y 31 Log-Normal Distributions Density: Single-tailed distribution of any random variable whose logarithm is normally distributed. Production (special transform): Has no simple closed form. Use the property that; If Y is normal(µ, σ 2 ) then X = e Y is log-normal(µ, σ 2 ) 32 16

Log-Normal Distributions Production (special transform): Let Y = Normal(µ, σ 2 ) Return X = e Y 33 Exponential Distributions Density: Describes the times between events in a Poisson process with rate parameter, λ. Production (inverse transform, rescale): Let U = RN(0,1) Return X = -1/λ ln(1-u) 34 17

Weibull Distributions Density: Describe the size distribution of particles with shape, k, and scale, λ. Production (inverse transform, rescale): Let U = RN(0,1) Return X = λ [-ln(1-u)] 1/k 35 Poisson Distributions Density: Probability of a number of events occurring in a fixed period of time with; k : number of occurrences of an event λ > 0 : expected number of occurrences in the fixed interval. The probability that there are exactly k occurrences of event is equal to 36 18

Poisson Distributions Production (counting events): Let a = e -λ Let p = 1 Let k = -1 While (p > a) Let U = RN(0,1) Let p = pu Let k = k+1 Return k 37 Discrete Integer-Valued Random Numbers Assume we have n integer numbers with probability of being selected p i for each How can we write a random variate generator? 38 19

Discrete Integer-Valued Random Numbers Build a table for cummulative probabilities (P i ) of n numbers. Use U = RN(0,1) to select n i from the table with P i-1 < U P i (let P 0 < 0). p 1 p 2 p 3 p 4 n 0 1 n 2 n 3 n 4 1 U selects one of the numbers randomly 39 20