Presentation is loading. Please wait.

Presentation is loading. Please wait.

 1  Outline  generation of random variates  convolution  composition  acceptance/rejection  generation of uniform(0, 1) random variates  linear.

Similar presentations


Presentation on theme: " 1  Outline  generation of random variates  convolution  composition  acceptance/rejection  generation of uniform(0, 1) random variates  linear."— Presentation transcript:

1  1  Outline  generation of random variates  convolution  composition  acceptance/rejection  generation of uniform(0, 1) random variates  linear congruential generators  generator in ARENA  tests of generators

2  2  Convolution  X = b 1 Y 1 +... + b n Y n  generate variates of Y 1 to Y n  sum b i Y i to get X Example 2.6.2 for Binomial Example 2.5.3 for Triangular Example 2.6.3 for Erlang (k,  )

3  3  Composition equivalent form in distribution F(x) = p 1 F 1 (x ) +... + p 1 F k (x ) use a zero-one uniform variate to determine the “type” and then generate the corresponding Y variate

4  4  Acceptance / Rejection  generate a variate from the uniform distribution on a disc of unit radius  1 o generate a variate of (X, Y) such that X, Y X, Y ~ i.i.d. uniform [-1, 1]  2 o accept (x, y) to be the desirable variate if x 2 + y 2  1; else go to 1 o  result: uniform in {(x, y)| x 2 + y 2  1}

5  5  Acceptance / Rejection Acceptance / Rejection – Discrete Distribution Acceptance / Rejection  X ~ {p i }; Y ~ {q i } such that p i /q i  c for all i  1 o Generate y from Y ~ {q i }.  2 o Generate u from U.  3 o If cq y u < p y, set x = y and stop; else go to 1 o. similar procedure applicable to continuous distribution with {p i }, {q i } replaced by the corresponding density functions primarily for continuous distributions whose F -1 is hard to find

6  6  Pseudo-Random Numbers  linear congruential generator linear congruential generator  Z i = (a Z i-1 + c) mod M  U i = Z i /M  Z 0 = seed (initial value)  for large M and suitably chosen a, c, M  Z i approximately ~ discrete uniform [0, M]  U i approximately ~ uniform [0, 1]

7  7  Comments on Linear Congruential Generators  {Z i }: a deterministic sequence given Z 0  sequence can change with seeds  sequences may not of full cycles (< M)  random numbers from LCG lie on planes of a hyper unit cube

8  8  Comments on Linear Congruential Generators  all right to use multiplicative LCG, i.e., c = 0  full period for suitable choice of M and a  Common Multiplicative LCG aM 44, 485, 709, 377, 9092 48 7575 2 31 -1 2 16 +32 31 -1 3972040942 31 -1

9  9  The Current (2000) Arena RNG  use some but not all idea of LCG  CMRG - Combined multiple recursive generator A n = (1403580 A n-2 – 810728 A n-3 ) mod 4294967087 B n = (527612 B n-1 – 1370589 B n-3 ) mod 4294944443 Z n = (A n – B n ) mod 4294967087 Seed = a six-vector of first three A n ’ s, B n ’ s Two simultaneous recursions Z n / 4294967088 if Z n > 0 4294967087 / 4294967088 if Z n = 0 U n =

10  10  The Current (2000) Arena RNG – Properties  extremely good statistical properties  good uniformity in up to 45-dimensional hypercube  cycle length = 3.1  10 57  to cycle, all six seeds must match up  on 600 MHz PC: 8.4  10 40 millennia to exhaust  only slightly slower than old LCG

11  11  The Current (2000) Arena RNG – Streams and Substreams  automatic streams and substreams  1.8  10 19 streams of length 1.7  10 38 each  a stream: 2.3  10 15 substreams of length 7.6  10 22 each  default stream is 10 (historical reasons)  possible to specify a different stream  e.g., EXPO(6.7, 4) to use stream 4  ARENA automatically advances to next substream in each stream for each replication  helps synchronize for variance reduction

12  12  Statistical Tests of Zero-One Random Number Generators  check whether data are from i.i.d. unif[0, 1]  quick test: mean and variance  goodness of fit:  2 test; K-S test  i.i.d.: j-lag correlation; run-up length  philosophy of tests: whether empirical evidence supports the statistical property under consideration

13  13  Quick Tests by Excel 0.66050.37310.66920.91570.59500.42340.51470.46660.15280.2280 0.65330.12120.58490.19150.34020.59940.65690.48780.76500.2408 0.64490.40190.94970.72420.15630.21780.98210.41640.22280.6927 0.66990.17160.61640.04160.72010.75760.93510.22450.97580.8835 0.32570.35770.22110.40770.09760.12440.19690.97830.92850.2933 0.81700.58520.56810.12670.02020.59110.71730.55700.90730.3972 0.79750.08110.88720.38500.59000.07840.48110.54120.23390.8267 0.23290.12730.42260.68940.71270.35240.28050.28250.17650.9473 0.71760.59130.94450.73360.50030.29530.79230.23220.43700.9498 0.11090.61710.58540.41580.26260.68700.85520.00220.64830.6830 mean? sample variance? confidence Interval?

14  14  Goodness of Fit Test –  2 Test  idea: the actual number of sample points in a given range should be close to the expected number in some sense  M ranges (categories)  e i : expected # of sample values in the ith range  a i : actual # of sample values in the ith range

15  15  Goodness of Fit Test –  2 Test approximately  2 distribution of M-1 degree of freedom lose one degree of freedom for each estimated parameter

16  16  Theory and Main Idea of  2 Goodness of Fit Test  (X 1, X 2,..., X k ) ~ Multinomial (n; p 1, p 2,..., p k )

17  17  Goodness-of-Fit Test  “better” to have e i = e j for i not equal to j  for this method to work, e i  5  choose significant level   decision: if, reject H 0 ; otherwise, accept H 0.

18  18  Goodness of Fit Test – K-S Test F(x)F(x) x empirical distribution compare with the distribution of unif[0, 1]

19  19  Goodness of Fit Test – K-S Test F(x)F(x) x largest difference find the “distance” between the empirical data and the uniform [0, 1] distribution the largest difference follow certain well defined distribution for n  20, D 0.05  1.36/(n) 0.5 D 0.01  1.63/(n) 0.5

20  20  j-lag Correlation Test  i.i.d. uniform [0, 1] random variables: covariance stationary random variables  estimate  j by:  if the data are truly uniform [0, 1]: cov(U i U i+j )/V(U i )

21  21  Run-up Length Test run ups can show that the lengths of runs are i.i.d. after deleting the numbers that start runs                      values of random variates order of random variates new length of runs becomes: 3, 4, 1, 0, 2, 1, 0, 2 discard

22  22  Run-up Length Test ✦ distribution of lengths (after deleting numbers that start runs): ✦ can use goodness of fit test to check the distributions of the run lengths


Download ppt " 1  Outline  generation of random variates  convolution  composition  acceptance/rejection  generation of uniform(0, 1) random variates  linear."

Similar presentations


Ads by Google