0% found this document useful (0 votes)
63 views

Random Variate Generation-1

This document discusses random variate generation techniques used in systems simulation. It describes: - Using random numbers from a uniform distribution to generate samples from specified probability distributions as inputs to simulation models. - Methods for discrete distributions like binomial and Poisson, and continuous distributions like exponential, normal, triangular, and uniform. - The inverse transform technique for continuous distributions, which uses the cumulative distribution function to map random numbers to random variates. - Examples of generating random variates using specific distributions and random numbers.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Random Variate Generation-1

This document discusses random variate generation techniques used in systems simulation. It describes: - Using random numbers from a uniform distribution to generate samples from specified probability distributions as inputs to simulation models. - Methods for discrete distributions like binomial and Poisson, and continuous distributions like exponential, normal, triangular, and uniform. - The inverse transform technique for continuous distributions, which uses the cumulative distribution function to map random numbers to random variates. - Examples of generating random variates using specific distributions and random numbers.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

SYSTEMS SIMULATION

RANDOM VARIATE
GENERATION
RANDOM VARIATE GENERATION

RANDOM VARIATE GENERATION


• Use random numbers to generate samples from a
specified probability distribution, which will be used as
input to simulation model.
• Assume that a probability distribution has been
completely specified.
• The input random numbers (R) for all the random
variate generation methods are from the Uniform (0,1)
distribution. To convert a whole number to decimal,
divide by 10k if midsquare and by m for the other
random number generation methods
RANDOM VARIATE GENERATION

A. DISCRETE PROBABILITY DISTRIBUTION


 BINOMIAL DISTRIBUTION
 POISSON DISTRIBUTION

B. CONTINUOUS PROBABILITY DISTRIBUTION


- EXPONENTIAL DISTRIBUTION
- NORMAL DISTRIBUTION
- TRIANGULAR DISTRIBUTION
- UNIFORM DISTRIBUTION
RANDOM VARIATE GENERATION

A. DISCRETE PROBABILITY DISTRIBUTION


- use mainly for empirical distributions where it is impossible to
establish that a random variable has any particular known
distribution
Example: Suppose the following distribution of interval times of
customers re given below:

INTERARRIVAL PDF CDF RANDOM NUMBER RANGES


TIME (MINUTES) (4DIGIT RN)
1 0.20 0.20 0.0000 - 0.1999
2 0.15 0.35 0.2000 – 0.3499
3 0.35 0.70 0.3500 – 0.6999
4 0.30 1.00 0.7000 – 0.9999
RANDOM VARIATE GENERATION
Use the Midsquare method (x0 = 3187) to generate 5 random numbers,
and use these RN to get 5 interarrival times of customers.

CUSTOMER NUMBER RANDOM NUMBER ( R ) INTERARRIVAL TIMES


(MINUTES)
1 x1 = R1 = .1569 1
2 x2 = R2 = .4617 3
3 x3 = R3 = .3166 2
4 x4 = R4 = .0235 1
5 x5 = R5 = .0552 1
RANDOM VARIATE GENERATION

• BINOMIAL DISTRIBUTION
To generate binomially distributed random numbers,
one simulates the outcome of a trial of the experiment
by generating a standard uniform distribution random
number. After all n trials have been simulated (n
standard uniform numbers have been generated), the
value of the binomially distributed random variable is
simply a count of those standard uniform numbers that
are less than or equal to p. This procedure is useful for
small to moderate values of n. For large values of n, the
normal approximation to the binomial should be used.
RANDOM VARIATE GENERATION

• Example:
Generate a random number from a binomial
distribution with n = 7, p = 0.3.
To simulate seven trials, generate seven standard
uniform numbers.
Assume that the numbers are 0.02011, 0.85393,
0.97265, 0.61680, 0.16656, 0.42751, and 0.69994.
Now two of these numbers are less than p = 0.3, so
the desired binomial random number is X = 2.
RANDOM VARIATE GENERATION


RANDOM VARIATE GENERATION
• Suppose that we wish to generate a random number
from a Poisson distribution with λ = 2.5. Suppose
further that we have generated the standard uniform
random numbers 0.91646, 0.89198, 0.64809,
0.16376, 0.91782, 0.45624, 0.31642. Then e-2.5 =
0.08208, and
• (0.91646)(0.89198) = 0.81746 > 0.08208
• (0.91646)(0.89198)(0.64809) = 0.52979 > 0.08208
• (0.91646)(0.89198)(0.64809)(0.17376) = 0.08675 >
0.08208
• (0.91646)(0.89198)(0.64809)(0.17376)(0.91782)
=0.07963 < 0.08208
Then N = 5 and hence the value of the Poisson-
distributed random number is X = N – 1 = 4
RANDOM VARIATE GENERATION

CONTINUOUS PROBABILITY DISTRIBUTION –


INVERSE TRANSFORM TECHNIQUE
Because of its statistical advantage, only the inverse
transform technique will be discussed here. In this
technique, the CDF is used to generate random
variates from the random numbers.
Distribution of the Random Numbers, r [Uniform (0,1)]
(PDF): f(x) = 1/x, for 0 ≤ x ≤ 1
(CDF): F(x) = 0, x<0
= x, 0≤x≤1
= 1 x>1
RANDOM VARIATE GENERATION

1. EXPONENTIAL DISTRIBUTION
f(X) = α e-αx , where α = average number of occurrences per unit time (rate)
F(X) = ∫0x α e-αx dX = - e-αx ]0x = 1 - e-αx
Recall that F(R) = R, to get our exponential RV(X) from R, isolate X.
R = 1 - e-αx 1- R = e-αx
ln (1-R) = ln (e-αx ) = αX
X = { - ln( 1-R)} {1/ α }
RANDOM VARIATE GENERATION

Example: Suppose that the service time is exponentially


distributed with mean = 10 minutes [rate: α = 1/10]. Generate 4
service times with the following random numbers:

R X = { - ln( 1-R)} {1/ (1/10) } = -10 ln (1-R)


0.058 0.60
0.073 0.76
0.479 6.52
0.948 29.57
RANDOM VARIATE GENERATION
2. NORMAL DISTRIBUTION
The normal distribution has 2 parameters (µ, σ2). To
transform the RN’s into RV’s from the normal
distribution, the Central Limit Theorem is very useful.
CLT: The sum of n RN’s is approximately normally
distributed with mean nµ and nσ2. The mean E(R)= ½,
and the variance Var(R) =1/12 of the random variables
taken from the formulas for the uniform distribution.
If we generate n RN’s and get their sum, then that sum
comes from the normal distribution with parameters
mean nµ and nσ2, where µ=1/2 and σ2=1/12.
Therefore, if we get the sum of 5 RN’s it should come
from a normal distribution with mean 5/2 and variance
5/12
For the sum of n RN’s, to transform it into Z value.
n
∑i=1 Ri-n/2
Z=
n/12
If we are given a normal distribution for which we must
generate RV’s from, then we can transform it into Z by
using Z= (X-µ[n]) / σ[n].
To transform RN’s into RVs, equate Z’s
n
∑i=1 Ri - n/2 (X-µ[N]) / σ[N].
Z= =
n/12
Isolating X
[ ∑i=1 Ri -n/2] σ[N]
X= +µ[N]
n/12
RANDOM VARIATE GENERATION
Suppose the standard uniform random numbers 0.1062,
0.1124, 0.7642, 0.4314, 0.6241, 0.9443, 0.8121,
0.2419, 0.3124, 0.5412, 0.6212, 0.0021 have been
generated. Generate a normal random number from a
distribution with mean 25 and variance 9.
Summing up the 12 RNs gives Y = 5.5135. This number is
from an approximate normal distribution with a mean of
6 and a variance of 1.
For computational case n=12 RN’s are usually added per
RV generated:
X= ∑12
i=1 Ri - 6] σ[N] + µ[N]
RANDOM VARIATE GENERATION
• For Y = 5.5135, the corresponding standard normal
number is Z = 5.5135 – 6 = -0.4865. Now
transforming this number to a normal distribution
with mean 25 and a variance 9 generates the
desired result.
• X = μ + σZ = 25 + 3(-0.4865) = 23.5405
3. TRIANGULAR DISTRIBUTION
Suppose we are given the following
F(x) f(x) = x, 0 ≤ x ≤ 1
(1,1)
2-x, 1 ≤ x ≤ 2

(2,0) x
1
F(0 ≤ x ≤ 1) = ∫0 xdx = x2/2 ]10 = ½
F(0 ≤ x ≤ 1) = 1 – ½ = 1/2
RN f(x) x
0≤R≤½ x 0≤x≤1
1/2 ≤ R ≤ 1 2-x 1≤x≤2
Case 1: 0≤R≤½
x x
R = F(X) = ∫0 x dx = x2 /2 ]0 = x2 /2
Isolating X
R = x2 /2 2R
Case 2: 1/2 ≤ R ≤ 1
1 1
R = ∫X (2-x) dx + 1/2 = (2x-x2/2) ]X
= 2x - x2/2 – 2 + ½ + ½
= 2x-x2/2 - 1
Isolating X:
2R = 4x -x2 – 2 → x2 - 4x + 2 + 2R = 0
RANDOM VARIATE GENERATION
X = 4± 16 – 8 – 8R = 4± 8 – 8R = 4±2 2 – 2R
2 2 2
X = 2 ± 2 -2R since X ≤ 2 → 2 – 2-R

Summarizing
RN X X’
0≤R≤½ 2R √kR
1/2 ≤ R ≤ 1 2- 2-2R 1-√(1-k)(1-R)
Example k =(c-a)/(b-a) X= a + (b-a)X’
where a = 1, b = 4 and c = 3
R = 0.3879 → X = 2.5255
R = 0.7567 → X = 3.1456
Note: The formulas derived for the triangular are
dependent f(x), i.e., different f(x) will give different
X formulas
4. UNIFORM DISTRIBUTION
QUESTION: If the RN’s are from the uniform distribution, why
do we need an RVGen technique for the uniform
distribution?
f(x) f(x)

f(x)
a b

R = F(x) = ∫a {1/ (b-a)}dx = x / (b-a) ]a = (X-a) / (b-a)


Isolating X
X = R(b – a) + a
Example: Generate RV from Uniform [1,3]
R = 0.4890 → X = 0.4890(3-1) + 1 = 1.978

You might also like