0% found this document useful (0 votes)
7 views37 pages

6 - Random Variates - 2025

The document discusses random variate generation techniques used in discrete-event system simulation, highlighting methods such as the inverse-transform technique, acceptance-rejection technique, and special properties. It provides algorithms for generating random variates from various probability distributions including exponential, uniform, Weibull, and empirical distributions. The summary emphasizes the importance of these techniques for generating samples for simulation modeling.

Uploaded by

dlhduyen2603
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views37 pages

6 - Random Variates - 2025

The document discusses random variate generation techniques used in discrete-event system simulation, highlighting methods such as the inverse-transform technique, acceptance-rejection technique, and special properties. It provides algorithms for generating random variates from various probability distributions including exponential, uniform, Weibull, and empirical distributions. The summary emphasizes the importance of these techniques for generating samples for simulation modeling.

Uploaded by

dlhduyen2603
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 37

Industrial Systems Engineering - International University – VNU-HCM SIMULATION

Chapter 8

Random Variate Generation

Discrete-Event System Simulation


1
Today question

Random Numbers

Probability Distributions
Random Variates EXPO(..)
Arrival rate TRIA(..)
Time between arrival NORM(..)
Process time WEIB(..)
Lead time empirical
… …

How to use Random Numbers to generate Random Variates?


2
Recall..

Grocery store with only one checkout counter.


▪ Customers arrive at random times from
1 to 8 minutes apart, with equal ▪ The service times vary from 1 to 6
probability of occurrence: minutes,
with probabilities:

Time between arrival


relation?
follows uniform Service time follows somerelation?
distribution statistical distribution? 3
Techniques to generate Random Variates

– Inverse-transform technique
– Acceptance-rejection technique
– Special properties

4
1. Inverse-transform Technique
1.1. Continuous distribution
● The concept: Suppose we
wish to generate a Random
Variate X that is continuous,
has distribution function cdf F:
0 < F(X) <1. Denote F-1 the
inverse of function F.
● The algorithm is F(x)
– For cdf function: R = F(X) 1
R = F(x)
1. Generate R from uniform U(0,1) R
2. Return X:

X = F-1(R) X
Fig. 8.1 Inverse Transform Method5 5
a. Exponential Distribution
● Exponential Distribution:
– Exponential

– Algorithm
● Generate R ~U(0,1)
● Solve 1-e-λx = R

● If we want to generate n values of


X:: X1, X2,…, Xn
- Generate uniform RN: R1, R2,…, Rn
- Return:

; i= 1, 2, …, n

6
a. Exponential Distribution (cont)

7
8
b. Uniform Distribution U(a,b)

– Uniform distribution

– Algorithm
●Generate R~U(0,1)
●Return X = a + (b-a)R

9
c. Weibull Distributions

– Weibull distribution

α, β are scale and shape parameters

– Algorithm
– Generate R~U(0,1)
– Return

10
d. Triangular distribution

11
12
Triangular Distribution (cont)

13
1.2 Empirical Continuous Distributions
● Unable to find theoretical distribution → use empirical distribution
● Procedure:
– Collect data Xi; i= 1, 2, …, n
– Arrange data from smallest to largest
– Assign the probability 1/n to each interval [xi-1, xi]
– Compute the slope of ith line segment
i/n
R

– Generate R
(i-1)/n
– Return
xi-1 x xi

14
1.2 Empirical Continuous Distributions (cont)
● Five observations of fire-crew response times (in mins.):
– 2.76 1.83 0.80 1.45 1.24
– Arranging x0 = 0; x1 = 0.8; x2 = 1.24; x3 = 1.45; x4 = 1.83; x5 = 2.76
– n=5 probability for each interval = 1/n = 0.2

15
1.2 Empirical Continuous Distributions (cont)

Consider R1 = 0.71:

(i-1)/n = 0.6 < R1 < i/n =


0.8

X1 = x(4-1) + a4(R1 – (4-1)/n)


= 1.45 + 1.90(0.71-0.60)
= 1.66

16
1. 3 Discrete Distribution

● Procedure
P(x)
– With given pmf P(xi) = P(X=xi),
compute cdf

(Assume that X can take only the value x 1<x2<… <xn) X1 X2 Xi-1 Xi
– Generate R~U(0,1) 1
– Determine the smallest integer I:
R≤ F(xI) R
Return X = xI
F2

X1 X2 Xi-1 Xi
17
1. 3 Discrete Distribution

18
1. 3 Discrete Distribution

19
1. 3 Discrete Uniform Distribution

Generate R~U(0,1)
If R satisfy:

Then return X = i
20
2. Acceptance-Rejection technique

The Acceptance-Rejection Method is useful for


generating samples from a target distribution f(x) when
direct inversion is difficult

21
2. Acceptance-Rejection technique

U∼U(0,1) (a uniform random variable for probabilistic


acceptance)

22
2. Acceptance-Rejection technique

g(x) should fully covers the range of f(x) and is easy to sample from
eg. f(x) Norm(0,1) → g(x) Unif(-3,3)

23
2. Acceptance-Rejection technique

Generate random variates, X ~ U(1/4, 1)


Step 1: Define the Target Density

Step 2: Choose a Proposal Distribution g(x) ~ U(0,1)

Step 3: Find the Acceptance Ratio

24
25
2. Acceptance-Rejection technique

● Illustration: To generate random variates, X ~ U(1/4, 1)


Generate R
Procedures:
no
Step 1. Generate R ~ U[0,1] Conditi
Step 2a. If R >= ¼, accept X=R. on
yes
Step 2b. If R < ¼, reject R, return
to Step 1 Output R’

● R does not have the desired distribution, but R conditioned (R’) on the
event {R ≥ ¼} does.
● Efficiency: Depends heavily on the ability to minimize the number of
rejections.

26
Mathematical proof

27
28
29
Poisson Distribution

Based on the relationship between Poisson(λ) and Expo(1/λ)


EXPO:

30
Poisson Distribution

•Set n = 0 and P =1
•Generate random number Ri+1 and replace P by

P x Ri+1 .
•If P < e-λ then accept X = n. Otherwise, reject current n, increase n
by 1 and return previous step.
31
Example
Generate three Poisson variates with mean α = 0.2.

32
33
Direct Transformation [Special Properties]

● Approach for normal(0,1):


– Consider two standard normal random variables, Z1 and Z2, plotted as a
point in the plane:

In polar coordinates:
Z1 = B cos φ
Z2 = B sin φ

– B2 = Z21 + Z22 ~ chi-square distribution with 2 degrees of freedom =


Exp(λ = 2). Hence,
– The radius B and angle φ are mutually independent.

34
35
Direct Transformation [Special Properties]

● Approach for normal (μ,σ2):


– Generate Zi ~ N(0,1)

Xi = μ + σ Zi

● Approach for lognormal(μ,σ2):


– Generate X ~ N(μ,σ2)

Yi = eXi

36
Summary

● Principles of random-variate generates of specified


distributions via
– Inverse-transform technique
– Acceptance-rejection technique
– Special properties

● Important for generating samples for different continuous


and discrete distributions as input to simulation modeling.

THANK YOU.
37

You might also like