



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
7.1 Properties of Random Numbers A sequence of random numbers
must have two important statistical
V ß á ß "^
8
properties:
and
Uniformity
Independence
Each
V μ Y Ò!ß "Ó
3 should be an independent realization (or sample) from a
variable:
x
0
1
f ( x ) 1
x
0
1
f ( x ) f ( 1 x ) f ( x ) 1
IÐVÑ œ
B.B œ
B l
œ
#^
"^
"^
"
!
Z +<ÐVÑ œ
œ
B l
œ
œ
$^
#^
$^
%^
"#
"^
#^
#^
$ "
"^
"^
"^
"^
"
!
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
Consequences of Uniformity and Independence Properties:
is divided into
subinterval of equal length, the expected
Ò!ß "Ó
number of observations in each interval is
where
is the total number of
R Î8ß
observations
the previous values drawn. 7.2 Generation of Pseudo-Random Numbers "Pseudo" means false, so false random numbers are being generated. If themethod is known the numbers cannot be truly random. The goal of anygeneration scheme is to
the real properties of a uniform distribution and
"imitate"
independence as closely as possible.
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Usually, pseudo-random numbers are generated by a computer as part of thesimulation. Numerous methods are available. In selecting a routine, there are anumber of important considerations.1. The routine should be fast2. The routine should be platform independent and portable between differentSource: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
programming languages.
required number of samples).
reduction techniques.
properties.
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
Inventing techniques that seem to generate random
number is easy; inventing techniques that reallyproduce sequences that appear to independent,
uniformly distributed is incredibly difficult.
7.3 Techniques for Generating Random Numbers
The linear congruential method is most widely known. Will also report anextension that yield sequences with a longer period. 7.3.1. Linear Congruential Method Generates a sequence
using
\ ß \ ß \ ß á
"^
#^
$
\
œ Ð+\ -Ñ 79. 7
3"
3
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp \ Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
œ #( ! \
œ Ð"( † #( %$Ñ 79. "!! œ &!# 79. "!! œ # " V
œ
œ !Þ!#
"^
œ Ð"( † # %$Ñ 79. "!! œ (( 79. "!! œ ((
V
œ
œ !Þ((
#^
( "!!
ã etc. Of primary importance is uniformity and statistical independence. Of secondary
importance is
and
within the sequence
maximum density
maximum period
V 3 œ "ß #ß á Þ
Note that, the sequence can only take values in:
Ö!ß "Î7ß #Î7ß á ß Ð7 "ÑÎ7ß "×
Thus
is discrete rather than continuous. V
3
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp This is easy to fix by choosing large modulus Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
. Values such as
and
7 œ #
$"
7 œ #
%)
are in common use in generators appearing in many simulation
languages). Maximum Density and Maximum period can be achieved by theproper choice of
and
!
For
a power of
, say
, and
, the longest period
is
7 œ #
T œ 7 œ #
,^
,
achieved provided
is a relative prime to
(that is the greates common
factor of
and
is
), and
where
is an integer.
For
a power of
, say
, and
, the longest period
7 œ #
,
T œ 7Î% œ #
,#
!
is achieved provided the seed
is odd and the multiplier
5 œ !ß "ß á
, for some
For
is a prime number and
, the longest period
is
T œ 7 "
achieved provided the multiplier
has the property that the smallest integer
5 œ 7 "
such that
is divisible by
is
5
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
Average
Variance
Average Gap
Over 500 Samples
Empe rical CDF of LCG Ge ne rator ov e r 500 Sample s
1.0000.9000.8000.7000.6000.5000.4000.3000.2000.100 0.
r
CDF
Em perical CDF
Uniform CDF
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
7.3.2. Combined Linear Congruential Method
Random Number Generator of Example 7.4. with a period of
$"
is no longer adequate with current advancements of computing powers. Area ofnew research is deriving generators with longer periods (See, L'Ecuyer [1998]).This research uses the following important result.
If
are independent discrete valued random variables (not
ß [
ß á [
3ß"
3ß#
3ß
necesarrily identical distributed), but one of them, say
, is uniformly
[
3ß"
distributed on the integers
, then
!ß á ß 7
"
[ œ
3
3ß
"
(^5) 4œ"
is uniformly distributed on the integers
!ß á ß 7
"
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Note that the Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
4"
3ß"
coefficient implicitly perform the subtraction
. For
example, if
5 œ #
"Ñ œ
!^
"^
4"
3ß"
3ß#
3ß
Maximum possible period for such a generator is:
T œ
(^5) # 3œ"
(^5) 5"
which is achieved by the following generator.
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp EXAMPLE 7.5:1. Selected seed Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
Selected seed
− Ò"ß #"%(%)$&'#Óß
− Ò"ß #"%(%)$$$*)ÓÞ
"!
#ß!
,
2 Evaluate each individual generator
œ Ð%!!"% † \
"ß4"
"ß
œ Ð%!
#ß4"
#ß
œ Ð\
4"
"ß4"
#ß4"
œ
œ !Þ
4"
#"%(%)$&'$
4
#"%(%)$&'##"%(%)$&'$
4
4"
and go to Step 2.
4 œ 4 "
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
7.4 Tests for Random Numbers
Desirable Properties: Uniformity and Independence
Uses the Kolmogorov-Smirnic or the Chi-Square Test to
Frequency Test: compare the distribution of the set of numbers to a uniform distribution.2.
Test the runs up and down or the runs above and below the mean
Runs Test: by comparin the actual values to expected values. The Statistics for comparisonis the chi-square test.3.
Test the correlation between numbers and compares the
Autocorrelation Test: sample correlation to the expected correlation of zero.4.
Counts the number of digits that appear between repetitions of a
Gap Test: particular digit and then uses the Kolmogorov Smirnov test to compare with theexpected sized of the gaps.5.
Treat numbers grouped together as a poker hand. Then the hands
Poker Test: obtained are compared to what is expected using the chi-square test.First Entry test for Uniformity. Second through Fifth Entry tests for Independence.
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp 7.4.1. Frequency Tests1. The Kolmogorov-Smirnov Test Test compares a continuous cdf Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
to an emperical cdf
, of the sample of
R
observations. Step 1: Determine Order Statistics
Ÿ á Ÿ V
Ð"Ñ
Ð#Ñ
ÐR Ñ
Define:
ÐBÑ œ
ß 3 œ "ß á ß R "
R
Ð"Ñ
(^3) R^
Ð3Ñ
Ð3"Ñ
ÐR Ñ
Step 2: Compute
via
H œ Q +B
lJ ÐBÑ W
ÐBÑl
B − Ò ∞ß ∞Ó
R
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp Step 3: Compute for significant level Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
or
(for
α
œ !Þ"!ß !Þ!&
œ
ß H
œ
ß H
œ
!Þ"!
!Þ!&
!Þ!"
Step 4: Test Hypothesis
œ
α α
Accept: No Difference between
and
Reject: No Difference between
and
R R
EMSE 273- Discrete System Simulation Lecture Notes by J.R. van Dorp
2. The Chi-square Test The chi-square test uses the sample statistic Source: Discrete Event Simulation by Banks Carson and Nelson Chapter 7
#!
(^8) 3œ"
3
3
3
œ
where
is the observed number in the
-th class,
is the expected number in
3
3
the
-th class, and
is the number of classes.
Step 1: Determine Order Statistics
Ÿ á Ÿ V
Ð"Ñ
Ð#Ñ
ÐR Ñ
Step 2: Divided Range
in
equidistant intervals
, such that
Ò+ ß , Ó
ÐR Ñ
Ð"Ñ
3
3
each interval has at least
observations. &
Step 3: Calculate for
3 œ "ß á ß R
S œ R † ÖW
Ð+ Ñ×ß I œ R † ÖJ Ð, Ñ J Ð+ Ñ×
3
R
3
R
3
3
3
3