Escolar Documentos
Profissional Documentos
Cultura Documentos
Generation
Discrete-Event System Simulation
test
Autocorrelation test.
Uniformity
Independence.
1, 0 x 1
f ( x)
0, otherwise
2
x
E ( R ) xdx
0
2
1
2
Figure: pdf for
random numbers
3
Fast
Portable to different computers
Have sufficiently long cycle
Closely approximate the ideal statistical properties of uniformity
and independence.
The
increment
The
modulus
Xi
, i 1,2,...
m
6
Example 7.1
R1 = 0.02;
R2 = 0.77;
R3 = 0.52;
Example 7.2
Maximum Density
Maximum Period
Uniformity
Independence
Apply tests
Apply tests
9
Two categories:
Tests
Test of uniformity
Kolmogorov-Smirnov test
Chi-square test
Test of independence :
Autocorrelation test
Runs Tests
Runs up and runs down test
Runs above and below the mean
Lenght of runs test
Gap test
Poker test
11
Kolmogorov-Smirnov Test
F ( x ) x, 0 x 1
We know:
If the sample from the RN generator is R1, R2, , RN, then the
empirical cdf, SN(x) is:
number of R , R ,..., R which are x
S N ( x)
12
Kolmogorov-Smirnov Test
Step 2:
R(i)
0.05
0.14
0.44
0.81
0.93
i/N
0.20
0.40
0.60
0.80
1.00
i/N R(i)
0.15
0.26
0.16
0.07
R(i) (i-1)/N
0.05
0.04
0.21
0.13
Chi-square test
(Oi Ei )
Ei
i 1
n
2
0
Ei is the expected
# in the ith class
Oi is the observed
# in the ith class
Example 7.7
100 random numbers have been generated as given on page 264
Test the generator for uniformity
Oi
interval
(Oi - Ei )2 / Ei
Ei
10
10
10
10
10
10
10
10
10
10
10
100
15
Hypothesis:
i (M 1 )m N
H 0 : im 0,
H1 : im 0,
im
16
im
Z0
im
1
im
M 1
im
R
k 0
i km
Ri (k 1 )m 0.25
13M 7
12(M 1 )
High random numbers tend to be followed by high ones, and vice versa.
Low random numbers tend to be followed by high ones, and vice versa.
17
Example 7.8
0.12 0.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.93
0.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.88
0.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87
18
Example 7.8
Test whether the 3rd, 8th, 13th, and so on, for the following
output on Page 265.
0.1945
13(4) 7
0.128
12( 4 1 )
0.1945
Z0
1.516
0.1280
35
Summary
Caution:
Even with generators that have been used for years, some of
which still in used, are found to be inadequate.
Also, even if generated numbers pass all the tests, some
underlying pattern might have gone undetected.
20