1 / 22

Outline

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. Convolution. X = b 1 Y 1 + ... + b n Y n generate variates of Y 1 to Y n

faolan
Download Presentation

Outline

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. Convolution • X = b1Y1 + ... + bnYn • generate variates of Y1toYn • sum biYi to get X Example 2.6.2 for Binomial Example 2.6.3 for Erlang (k,) Example 2.5.3 for Triangular

  3. Composition equivalent form in distribution F(x) = p1F1(x ) + ... + p1Fk(x ) use a zero-one uniform variate to determine the “type” and then generate the correspondingYvariate

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

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

  6. Pseudo-Random Numbers • linear congruential generator • Zi = (a Zi-1 + c) mod M • Ui = Zi/M • Z0 =seed(initial value) • for large Mand suitably chosen a, c, M • Zi approximately ~ discrete uniform [0, M] • Ui approximately ~ uniform [0, 1]

  7. Comments on Linear Congruential Generators • {Zi}:a deterministic sequence given Z0 • sequence can change with seeds • sequences may not of full cycles (< M) • random numbers from LCGlie on planes of a hyper unit cube

  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

  9. Zn / 4294967088 if Zn > 0 4294967087 / 4294967088 if Zn = 0 Un = The Current (2000) Arena RNG Two simultaneous recursions • use some but not all idea of LCG • CMRG - Combined multiple recursive generator An = (1403580 An-2– 810728 An-3) mod 4294967087 Bn = (527612 Bn-1– 1370589 Bn-3) mod 4294944443 Zn = (An–Bn) mod 4294967087 Seed = a six-vector of first three An’s, Bn’s

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

  11. The Current (2000) Arena RNG – Streams and Substreams • automatic streams and substreams • 1.8  1019 streams of length 1.7  1038 each • a stream: 2.3  1015 substreams of length 7.6  1022 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. 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. Quick Tests by Excel confidence Interval? sample variance? mean?

  14. Goodness of Fit Test – 2Test • idea: the actual number of sample points in a given range should be close to the expected number in some sense • Mranges (categories) • ei: expected # of sample values in the ith range • ai: actual # of sample values in the ith range

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

  16. Theory and Main Idea of 2 Goodness of Fit Test • (X1, X2, ..., Xk) ~ Multinomial (n; p1, p2, ..., pk)

  17. decision: if , reject H0; otherwise, accept H0. Goodness-of-Fit Test • “better” to have ei = ej for i not equal to j • for this method to work, ei 5 • choose significant level 

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

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

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

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

  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

More Related