28-1 ©2006 Raj Jain www.rajjain.com Random Variate Generation.

Slides:



Advertisements
Similar presentations
2k-p Fractional Factorial Designs
Advertisements

Chapter 3 Some Special Distributions Math 6203 Fall 2009 Instructor: Ayona Chatterjee.
JMB Chapter 6 Part 1 v2 EGR 252 Spring 2009 Slide 1 Continuous Probability Distributions Many continuous probability distributions, including: Uniform.
ISE525: Generating Random Variables. Sources of randomness in a computer? Methods for generating random numbers: – Time of day (Seconds since midnight)
CPSC 531:Random-Variate Generation
Chapter 8 Random-Variate Generation
Chapter 8 Random-Variate Generation Banks, Carson, Nelson & Nicol Discrete-Event System Simulation.
Random Number Generators. Why do we need random variables? random components in simulation → need for a method which generates numbers that are random.
Random-Variate Generation. Need for Random-Variates We, usually, model uncertainty and unpredictability with statistical distributions Thereby, in order.
Simulation Modeling and Analysis
Probability Densities
Agenda Purpose Prerequisite Inverse-transform technique
Comparing Systems Using Sample Data
Random Number Generation
Random-Variate Generation. 2 Purpose & Overview Develop understanding of generating samples from a specified distribution as input to a simulation model.
A Summary of Random Variable Simulation Ideas for Today and Tomorrow.
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 4 Continuous Random Variables and Probability Distributions.
Week 51 Relation between Binomial and Poisson Distributions Binomial distribution Model for number of success in n trails where P(success in any one trail)
Chapter 21 Random Variables Discrete: Bernoulli, Binomial, Geometric, Poisson Continuous: Uniform, Exponential, Gamma, Normal Expectation & Variance, Joint.
Plots and Random #s EXCEL Functions. Obtaining a Density Function l Create a column with a range of values of x containing a large portion of the density.
Random-Number Generation. 2 Properties of Random Numbers Random Number, R i, must be independently drawn from a uniform distribution with pdf: Two important.
Random Number Generation Pseudo-random number Generating Discrete R.V. Generating Continuous R.V.
ETM 607 – Random Number and Random Variates
Standard Statistical Distributions Most elementary statistical books provide a survey of commonly used statistical distributions. The reason we study these.
Functions of Random Variables. Methods for determining the distribution of functions of Random Variables 1.Distribution function method 2.Moment generating.
Week 41 Continuous Probability Spaces Ω is not countable. Outcomes can be any real number or part of an interval of R, e.g. heights, weights and lifetimes.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved.
CPSC 531: Probability Review1 CPSC 531:Distributions Instructor: Anirban Mahanti Office: ICT Class Location: TRB 101.
0 Simulation Modeling and Analysis: Input Analysis K. Salah 8 Generating Random Variates Ref: Law & Kelton, Chapter 8.
Chapter 5 Statistical Models in Simulation
Commonly Used Distributions Andy Wang CIS Computer Systems Performance Analysis.
Moment Generating Functions
PROBABILITY AND STATISTICS FOR ENGINEERING Hossein Sameti Department of Computer Engineering Sharif University of Technology Two Functions of Two Random.
Functions of Random Variables. Methods for determining the distribution of functions of Random Variables 1.Distribution function method 2.Moment generating.
CS433 Modeling and Simulation Lecture 15 Random Number Generator Dr. Anis Koubâa 24 May 2009 Al-Imam Mohammad Ibn Saud Islamic University College Computer.
Use of moment generating functions 1.Using the moment generating functions of X, Y, Z, …determine the moment generating function of W = h(X, Y, Z, …).
Continuous Distributions The Uniform distribution from a to b.
Stochastic Models Lecture 2 Poisson Processes
LECTURE 25 SIMULATION AND MODELING Md. Tanvir Al Amin, Lecturer, Dept. of CSE, BUET CSE 411.
One Random Variable Random Process.
COMP155 Computer Simulation September 8, States and Events  A state is a condition of a system at some point in time  An event is something that.
ETM 607 – Random-Variate Generation
EE 5345 Multiple Random Variables
1 8. One Function of Two Random Variables Given two random variables X and Y and a function g(x,y), we form a new random variable Z as Given the joint.
Expectation. Let X denote a discrete random variable with probability function p(x) (probability density function f(x) if X is continuous) then the expected.
Starting point for generating other distributions.
Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they.
Chapter 5a:Functions of Random Variables Yang Zhenlin.
Chapter 8 Random-Variate Generation Banks, Carson, Nelson & Nicol Discrete-Event System Simulation.
Gil McVean, Department of Statistics Thursday February 12 th 2009 Monte Carlo simulation.
Ver Chapter 5 Continuous Random Variables 1 Probability/Ch5.
Module 9.4 Random Numbers from Various Distributions -MC requires the use of unbiased random numbers.
Chapter 4 Particular Methods for Non- Uniform Random Variables.
Generating Random Variates
3. Random Variables (Fig.3.1)
Random Variable 2013.
Random Variates 2 M. Overstreet Spring 2005
Random-Variate Generation
Example Suppose X ~ Uniform(2, 4). Let . Find .
GENERATING NON-UNIFORM RANDOM DEVIATES
Chapter 8 Random-Variate Generation
GENERATING NON-UNIFORM RANDOM DEVIATES
EMIS 7300 SYSTEMS ANALYSIS METHODS FALL 2005
Functions of Random variables
8. One Function of Two Random Variables
Chapter 3 : Random Variables
Random Variate Generation
8. One Function of Two Random Variables
Generating Random Variates
Presentation transcript:

28-1 ©2006 Raj Jain Random Variate Generation

28-2 ©2006 Raj Jain Overview 1.Inverse transformation 2.Rejection 3.Composition 4.Convolution 5.Characterization

28-3 ©2006 Raj Jain Random-Variate Generation  General Techniques  Only a few techniques may apply to a particular distribution  Look up the distribution in Chapter 29

28-4 ©2006 Raj Jain Inverse Transformation  Used when F -1 can be determined either analytically or empirically u 1.0 x CDF F(x)

28-5 ©2006 Raj Jain Proof

28-6 ©2006 Raj Jain Example 28.1  For exponential variates:  If u is U(0,1), 1-u is also U(0,1)  Thus, exponential variables can be generated by:

28-7 ©2006 Raj Jain Example 28.2  The packet sizes (trimodal) probabilities:  The CDF for this distribution is:

28-8 ©2006 Raj Jain Example 28.2 (Cont)  The inverse function is:  Note: CDF is continuous from the right  the value on the right of the discontinuity is used  The inverse function is continuous from the left  u=0.7  x=64

28-9 ©2006 Raj Jain Applications of the Inverse-Transformation Technique

28-10 ©2006 Raj Jain Rejection  Can be used if a pdf g(x) exists such that c g(x) majorizes the pdf f(x)  c g(x) > f(x) 8 x  Steps: 1. Generate x with pdf g(x). 2. Generate y uniform on [0, cg(x)]. 3. If y f(x)  Efficiency = how closely c g(x) envelopes f(x) Large area between c g(x) and f(x)  Large percentage of (x, y) generated in steps 1 and 2 are rejected  If generation of g(x) is complex, this method may not be efficient.

28-11 ©2006 Raj Jain Example 28.2  Beta(2,4) density function:  Bounded inside a rectangle of height 2.11  Steps:  Generate x uniform on [0, 1].  Generate y uniform on [0, 2.11].  If y < 20 x(1-x) 3, then output x and return. Otherwise repeat from step 1.

28-12 ©2006 Raj Jain Composition  Can be used if CDF F(x) = Weighted sum of n other CDFs.  Here,, and F i 's are distribution functions.  n CDFs are composed together to form the desired CDF Hence, the name of the technique.  The desired CDF is decomposed into several other CDFs  Also called decomposition.  Can also be used if the pdf f(x) is a weighted sum of n other pdfs:

28-13 ©2006 Raj Jain Steps:  Generate a random integer I such that:  This can easily be done using the inverse- transformation method.  Generate x with the ith pdf f i (x) and return.

28-14 ©2006 Raj Jain Example 28.4  pdf:  Composition of two exponential pdf's  Generate  If u 1 <0.5, return; otherwise return x=a ln u 2.  Inverse transformation better for Laplace

28-15 ©2006 Raj Jain Convolution  Sum of n variables:  Generate n random variate y i 's and sum  For sums of two variables, pdf of x = convolution of pdfs of y 1 and y 2. Hence the name  Although no convolution in generation  If pdf or CDF = Sum  Composition  Variable x = Sum  Convolution

28-16 ©2006 Raj Jain Convolution: Examples  Erlang-k =  i=1 k Exponential i  Binomial(n, p) =  i=1 n Bernoulli(p)  Generated n U(0,1), return the number of RNs less than p    ( ) =  i=1 N(0,1) 2   a, b  )+  (a,b 2 )=  (a,b 1 +b 2 )  Non-integer value of b = integer + fraction    n Any = Normal   U(0,1)  Normal    m Geometric = Pascal    2 Uniform = Triangular

28-17 ©2006 Raj Jain Characterization  Use special characteristics of distributions  characterization  Exponential inter-arrival times  Poisson number of arrivals  Continuously generate exponential variates until their sum exceeds T and return the number of variates generated as the Poisson variate.  The a th smallest number in a sequence of a+b+1 U(0,1) uniform variates has a  (a, b) distribution.  The ratio of two unit normal variates is a Cauchy(0, 1) variate.  A chi-square variate with even degrees of freedom  2 ( ) is the same as a gamma variate  (2, /2).  If x 1 and x 2 are two gamma variates  (a,b) and  (a,c), respectively, the ratio x 1 /(x 1 +x 2 ) is a beta variate  (b,c).  If x is a unit normal variate, e  +  x is a lognormal( ,  ) variate.

28-18 ©2006 Raj Jain Summary Is pdf a sum of other pdfs? Use Composition Yes Is CDF a sum of other CDFs? Use composition Yes Is CDF invertible? Use inversion Yes

28-19 ©2006 Raj Jain Summary (Cont) Does a majorizing function exist? Use rejection Yes Is the variate related to other variates? Use characterization Yes Is the variate a sum of other variates Use convolution Yes Use empirical inversion No

28-20 ©2006 Raj Jain Exercise 28.1  A random variate has the following triangular density:  Develop algorithms to generate this variate using each of the following methods: a.Inverse-transformation b.Rejection c.Composition d.Convolution

28-21 ©2006 Raj Jain Homework  A random variate has the following triangular density:  Develop algorithms to generate this variate using each of the following methods: a.Inverse-transformation b.Rejection c.Composition d.Convolution

28-22 ©2006 Raj Jain Answer to Homework  A random variate has the following triangular density:  Develop algorithms to generate this variate using each of the following methods: a.Inverse-transformation F(x) = a.Rejection b.Composition c.Convolution

28-23 ©2006 Raj Jain Inverse Transformation 048 x x F(x) 048 x f(x) x/16(8-x)/

28-24 ©2006 Raj Jain Rejection  Find a majoring function: f(x) < cg(x)  Generate x with g(x) and generate y uniform on (0,cg(x))  If y < f(x), then output x and return. Otherwise, repeat from step 1.  g(x) = 1/8 0<x<8, c=2  Generate x with U(0,8) and y with U(0,0.25) if y<(1/16)min(x,8-x) output x, otherwise repeat 048 x f(x) x/16(8-x)/

28-25 ©2006 Raj Jain Composition  Can be used if the pdf f(x) is a weighted sum of n other pdfs: 048 x f(x) x/16 1/4 048 x f(x) (8-x)/16 1/4  Generate u1 = U(0,1), if u1 0.5 use right triangle to generate x  Left Triangle: f(x)=x/16 => F(x)=x 2 /32=u =>  Right Triangle: f(x)=(8-x)/16  F(x)=x-x 2 /32=u 

28-26 ©2006 Raj Jain Convolution  Sum of n variables:  Generate n random variate y i 's and sum  Triangle is a convolution of two squares 04u1 f(x) 1/4 04u2 f(x) 1/4 048 x f(x) 0.25  Generate u1=U(0,4)  Generate u2=U(0,4)  Return x=u1+u2

28-27 ©2006 Raj Jain Thank You!

28-28 ©2006 Raj Jain Copyright Notice  These slides have been provided to instructors using “The Art of Computer Systems Performance Analysis” as the main textbook in their course or tutorial.  Any other use of these slides is prohibited.  Instructors are allowed to modify the content or templates of the slides to suite their audience.  The copyright notice on every slide and this copyright slide should not be removed when these slides’ content or templates are modified.  These slides or their modified versions are not transferable to other instructors without their agreeing with these conditions directly with the author.