Chapter 8: RandomVariant Generation - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Chapter 8: RandomVariant Generation

Description:

Illustrate some widely-used techniques for generating random variates. ... number of shipments, x, on the loading dock of IHW company is either 0, 1, or 2 ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 20
Provided by: Gig58
Category:

less

Transcript and Presenter's Notes

Title: Chapter 8: RandomVariant Generation


1
Random-Variate Generation
2
Purpose Overview
  • Develop understanding of generating samples from
    a specified distribution as input to a simulation
    model.
  • Illustrate some widely-used techniques for
    generating random variates.
  • Inverse-transform technique
  • Convolution technique
  • Acceptance-rejection technique
  • A special technique for normal distribution

2
3
Inverse-transform Technique
  • The concept
  • For cdf function r F(x)
  • Generate R sample from uniform (0,1)
  • Find X sample

X F-1(R)
3
4
Exponential Distribution Inverse-transform
  • Exponential Distribution
  • Exponential cdf
  • To generate X1, X2, X3 , generate R1, R2, R3 ,

r F(x) 1 e-?x for x ??0
Xi F-1(Ri) -(1/?? ln(1-Ri)
Figure Inverse-transform technique for exp(? 1)
4
5
Exponential Distribution Inverse-transform
  • Example Generate 200 variates Xi with
    distribution exp(? 1)
  • Matlab Code
  • for i1200,
  • expnum(i)-log(rand(1))
  • end

R and (1 R) have U(0,1) distribution
5
6
Uniform Distribution Inverse-transform
  • Uniform Distribution
  • Uniform cdf
  • To generate X1, X2, X3 ,, generate R1, R2, R3 ,

6
7
Uniform Distribution Inverse-transform
  • Example Generate 500 variates Xi with
    distribution Uniform (3,8)
  • Matlab Code
  • for i1500,
  • uninum(i)35rand(1)
  • end

7
8
Empirical Continuous Distn Inverse-transform
  • When theoretical distribution is not applicable
  • To collect empirical data
  • Resample the observed data
  • Interpolate between observed data points to fill
    in the gaps
  • For a small sample set (size n)
  • Arrange the data from smallest to largest
  • Assign the probability 1/n to each interval
  • where

8
9
Empirical Continuous Distn Inverse-transform
  • Example Suppose the data collected for 100
    broken-widget repair times are

Consider R1 0.83 c3 0.66 lt R1 lt c4
1.00 X1 x(4-1) a4(R1 c(4-1)) 1.5
1.47(0.83-0.66) 1.75
9
10
Discrete Distribution Inverse-transform
All discrete distributions can be generated by
the Inverse-transform technique.
F(x)
p1 p2 p3
p1 p2
R1
p1
General Form
b
a
c
10
11
Discrete Distribution Inverse-transform
  • Example Suppose the number of shipments, x, on
    the loading dock of IHW company is either 0, 1,
    or 2
  • Data - Probability distribution
  • Method - Given R, the generation
  • scheme becomes

Consider R1 0.73 F(xi-1) lt R lt
F(xi) F(x0) lt 0.73 lt F(x1) Hence, x1 1
11
12
Convolution Technique
  • Use for X Y1 Y2 Yn
  • Example of application
  • Erlang distribution
  • Generate samples for Y1 , Y2 , , Yn and then
    add these samples to get a sample of X.

12
13
Erlang Distribution Convolution
  • Example Generate 500 variates Xi with
    distribution Erlang-3 (mean k/????????
  • Matlab Code
  • for i1500,
  • erlnum(i)-1/6(log(rand(1))log(rand(1))log(rand
    (1)))
  • end

13
14
Acceptance-Rejection technique
  • Useful particularly when inverse cdf does not
    exist in closed form
  • a.k.a. thinning
  • Steps to generate X with pdf f(x)
  • Step 0 Identify a majorizing function g(x) and a
    pdf h(x) satisfying
  • Step 1 Generate Y with pdf h(x)
  • Step 2 Generate U Uniform(0,1) independent of
    Y
  • Step 3

Efficiency parameter is c
14
15
Triangular Distribution Acceptance-Rejection
  • Example

15
16
Triangular Distribution Acceptance-Rejection
Matlab Code (for exactly 1000 samples) i0 while
ilt1000, Yrand(1) Urand(1) if
Ylt0.5 Ult2Y Ygt0.5 Ult2-2Y
ii1 X(i)Y end end
16
17
Normal Distribution Special Technique
  • Approach for normal(0,1)
  • Consider two standard normal random variables, Z1
    and Z2, plotted as a point in the plane
  • B2 Z21 Z22 chi-square distribution with 2
    degrees of freedom Exp(? 1/2). Hence,
  • The radius B and angle ? are mutually
    independent.

??? Uniform(0,2??
In polar coordinates Z1 B cos ? Z2 B sin ?
17
18
Normal Distribution Special Technique
  • Approach for normal(?,??)
  • Generate Zi N(0,1)
  • Approach for lognormal(?,??)
  • Generate X N(?,??)

Xi ? ? Zi
Yi eXi
18
19
Normal Distribution Special Technique
  • Generate 1000 samples of Normal(7,4)
  • Matlab Code
  • for i1500,
  • R1rand(1)
  • R2rand(1)
  • Z(2i-1)sqrt(-2log(R1))cos(2piR2)
  • Z(2i)sqrt(-2log(R1))sin(2piR2)
  • end
  • for i11000,
  • Z(i)72Z(i)
  • end

19
Write a Comment
User Comments (0)
About PowerShow.com