Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NOTE: Most of the tests in DIEHARD return a p-value, which
- should be uniform on [0,1) if the input file contains truly
- independent random bits. Those p-values are obtained by
- p=F(X), where F is the assumed distribution of the sample
- random variable X---often normal. But that assumed F is just
- an asymptotic approximation, for which the fit will be worst
- in the tails. Thus you should not be surprised with
- occasional p-values near 0 or 1, such as .0012 or .9983.
- When a bit stream really FAILS BIG, you will get p's of 0 or
- 1 to six or more places. By all means, do not, as a
- Statistician might, think that a p < .025 or p> .975 means
- that the RNG has "failed the test at the .05 level". Such
- p's happen among the hundreds that DIEHARD produces, even
- with good RNG's. So keep in mind that " p happens".
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the BIRTHDAY SPACINGS TEST ::
- :: Choose m birthdays in a year of n days. List the spacings ::
- :: between the birthdays. If j is the number of values that ::
- :: occur more than once in that list, then j is asymptotically ::
- :: Poisson distributed with mean m^3/(4n). Experience shows n ::
- :: must be quite large, say n>=2^18, for comparing the results ::
- :: to the Poisson distribution with that mean. This test uses ::
- :: n=2^24 and m=2^9, so that the underlying distribution for j ::
- :: is taken to be Poisson with lambda=2^27/(2^26)=2. A sample ::
- :: of 500 j's is taken, and a chi-square goodness of fit test ::
- :: provides a p value. The first test uses bits 1-24 (counting ::
- :: from the left) from integers in the specified file. ::
- :: Then the file is closed and reopened. Next, bits 2-25 are ::
- :: used to provide birthdays, then 3-26 and so on to bits 9-32. ::
- :: Each set of bits provides a p-value, and the nine p-values ::
- :: provide a sample for a KSTEST. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000
- Results for gcd1_random.dat
- For a sample of size 500: mean
- gcd1_random.dat using bits 1 to 24 1.988
- duplicate number number
- spacings observed expected
- 0 82. 67.668
- 1 125. 135.335
- 2 134. 135.335
- 3 78. 90.224
- 4 51. 45.112
- 5 20. 18.045
- 6 to INF 10. 8.282
- Chisquare with 6 d.o.f. = 6.83 p-value= .663248
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 2 to 25 1.984
- duplicate number number
- spacings observed expected
- 0 60. 67.668
- 1 138. 135.335
- 2 146. 135.335
- 3 87. 90.224
- 4 50. 45.112
- 5 15. 18.045
- 6 to INF 4. 8.282
- Chisquare with 6 d.o.f. = 5.13 p-value= .473262
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 3 to 26 1.962
- duplicate number number
- spacings observed expected
- 0 69. 67.668
- 1 144. 135.335
- 2 132. 135.335
- 3 85. 90.224
- 4 44. 45.112
- 5 17. 18.045
- 6 to INF 9. 8.282
- Chisquare with 6 d.o.f. = 1.12 p-value= .019159
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 4 to 27 2.008
- duplicate number number
- spacings observed expected
- 0 74. 67.668
- 1 131. 135.335
- 2 135. 135.335
- 3 79. 90.224
- 4 47. 45.112
- 5 26. 18.045
- 6 to INF 8. 8.282
- Chisquare with 6 d.o.f. = 5.72 p-value= .545229
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 5 to 28 1.966
- duplicate number number
- spacings observed expected
- 0 69. 67.668
- 1 129. 135.335
- 2 142. 135.335
- 3 95. 90.224
- 4 48. 45.112
- 5 12. 18.045
- 6 to INF 5. 8.282
- Chisquare with 6 d.o.f. = 4.41 p-value= .379183
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 6 to 29 2.014
- duplicate number number
- spacings observed expected
- 0 61. 67.668
- 1 132. 135.335
- 2 145. 135.335
- 3 92. 90.224
- 4 47. 45.112
- 5 17. 18.045
- 6 to INF 6. 8.282
- Chisquare with 6 d.o.f. = 2.23 p-value= .102884
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 7 to 30 1.984
- duplicate number number
- spacings observed expected
- 0 60. 67.668
- 1 136. 135.335
- 2 149. 135.335
- 3 93. 90.224
- 4 43. 45.112
- 5 10. 18.045
- 6 to INF 9. 8.282
- Chisquare with 6 d.o.f. = 6.08 p-value= .586253
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 8 to 31 1.940
- duplicate number number
- spacings observed expected
- 0 75. 67.668
- 1 126. 135.335
- 2 154. 135.335
- 3 86. 90.224
- 4 33. 45.112
- 5 18. 18.045
- 6 to INF 8. 8.282
- Chisquare with 6 d.o.f. = 7.47 p-value= .720594
- :::::::::::::::::::::::::::::::::::::::::
- For a sample of size 500: mean
- gcd1_random.dat using bits 9 to 32 2.056
- duplicate number number
- spacings observed expected
- 0 74. 67.668
- 1 117. 135.335
- 2 130. 135.335
- 3 109. 90.224
- 4 37. 45.112
- 5 25. 18.045
- 6 to INF 8. 8.282
- Chisquare with 6 d.o.f. = 11.34 p-value= .921682
- :::::::::::::::::::::::::::::::::::::::::
- The 9 p-values were
- .663248 .473262 .019159 .545229 .379183
- .102884 .586253 .720594 .921682
- A KSTEST for the 9 p-values yields .101082
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: THE OVERLAPPING 5-PERMUTATION TEST ::
- :: This is the OPERM5 test. It looks at a sequence of one mill- ::
- :: ion 32-bit random integers. Each set of five consecutive ::
- :: integers can be in one of 120 states, for the 5! possible or- ::
- :: derings of five numbers. Thus the 5th, 6th, 7th,...numbers ::
- :: each provide a state. As many thousands of state transitions ::
- :: are observed, cumulative counts are made of the number of ::
- :: occurences of each state. Then the quadratic form in the ::
- :: weak inverse of the 120x120 covariance matrix yields a test ::
- :: equivalent to the likelihood ratio test that the 120 cell ::
- :: counts came from the specified (asymptotically) normal dis- ::
- :: tribution with the specified 120x120 covariance matrix (with ::
- :: rank 99). This version uses 1,000,000 integers, twice. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- OPERM5 test for file gcd1_random.dat
- For a sample of 1,000,000 consecutive 5-tuples,
- chisquare for 99 degrees of freedom= 90.794; p-value= .290241
- OPERM5 test for file gcd1_random.dat
- For a sample of 1,000,000 consecutive 5-tuples,
- chisquare for 99 degrees of freedom= 82.986; p-value= .123386
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the BINARY RANK TEST for 31x31 matrices. The leftmost ::
- :: 31 bits of 31 random integers from the test sequence are used ::
- :: to form a 31x31 binary matrix over the field {0,1}. The rank ::
- :: is determined. That rank can be from 0 to 31, but ranks< 28 ::
- :: are rare, and their counts are pooled with those for rank 28. ::
- :: Ranks are found for 40,000 such random matrices and a chisqua-::
- :: re test is performed on counts for ranks 31,30,29 and <=28. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Binary rank test for gcd1_random.dat
- Rank test for 31x31 binary matrices:
- rows from leftmost 31 bits of each 32-bit integer
- rank observed expected (o-e)^2/e sum
- 28 194 211.4 1.435011 1.435
- 29 5116 5134.0 .063180 1.498
- 30 23083 23103.0 .017395 1.516
- 31 11607 11551.5 .266419 1.782
- chisquare= 1.782 for 3 d. of f.; p-value= .472094
- --------------------------------------------------------------
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the BINARY RANK TEST for 32x32 matrices. A random 32x ::
- :: 32 binary matrix is formed, each row a 32-bit random integer. ::
- :: The rank is determined. That rank can be from 0 to 32, ranks ::
- :: less than 29 are rare, and their counts are pooled with those ::
- :: for rank 29. Ranks are found for 40,000 such random matrices ::
- :: and a chisquare test is performed on counts for ranks 32,31, ::
- :: 30 and <=29. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Binary rank test for gcd1_random.dat
- Rank test for 32x32 binary matrices:
- rows from leftmost 32 bits of each 32-bit integer
- rank observed expected (o-e)^2/e sum
- 29 208 211.4 .055259 .055
- 30 4976 5134.0 4.863107 4.918
- 31 23084 23103.0 .015703 4.934
- 32 11732 11551.5 2.819666 7.754
- chisquare= 7.754 for 3 d. of f.; p-value= .951295
- --------------------------------------------------------------
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the BINARY RANK TEST for 6x8 matrices. From each of ::
- :: six random 32-bit integers from the generator under test, a ::
- :: specified byte is chosen, and the resulting six bytes form a ::
- :: 6x8 binary matrix whose rank is determined. That rank can be ::
- :: from 0 to 6, but ranks 0,1,2,3 are rare; their counts are ::
- :: pooled with those for rank 4. Ranks are found for 100,000 ::
- :: random matrices, and a chi-square test is performed on ::
- :: counts for ranks 6,5 and <=4. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Binary Rank Test for gcd1_random.dat
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 1 to 8
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 957 944.3 .171 .171
- r =5 21653 21743.9 .380 .551
- r =6 77390 77311.8 .079 .630
- p=1-exp(-SUM/2)= .27016
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 2 to 9
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 904 944.3 1.720 1.720
- r =5 21568 21743.9 1.423 3.143
- r =6 77528 77311.8 .605 3.748
- p=1-exp(-SUM/2)= .84646
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 3 to 10
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 994 944.3 2.616 2.616
- r =5 21523 21743.9 2.244 4.860
- r =6 77483 77311.8 .379 5.239
- p=1-exp(-SUM/2)= .92716
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 4 to 11
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 967 944.3 .546 .546
- r =5 21589 21743.9 1.103 1.649
- r =6 77444 77311.8 .226 1.875
- p=1-exp(-SUM/2)= .60842
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 5 to 12
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 925 944.3 .395 .395
- r =5 21667 21743.9 .272 .666
- r =6 77408 77311.8 .120 .786
- p=1-exp(-SUM/2)= .32503
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 6 to 13
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 911 944.3 1.174 1.174
- r =5 21867 21743.9 .697 1.871
- r =6 77222 77311.8 .104 1.976
- p=1-exp(-SUM/2)= .62761
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 7 to 14
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 934 944.3 .112 .112
- r =5 21780 21743.9 .060 .172
- r =6 77286 77311.8 .009 .181
- p=1-exp(-SUM/2)= .08649
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 8 to 15
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 908 944.3 1.396 1.396
- r =5 21546 21743.9 1.801 3.197
- r =6 77546 77311.8 .709 3.906
- p=1-exp(-SUM/2)= .85816
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 9 to 16
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 949 944.3 .023 .023
- r =5 21735 21743.9 .004 .027
- r =6 77316 77311.8 .000 .027
- p=1-exp(-SUM/2)= .01353
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 10 to 17
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 930 944.3 .217 .217
- r =5 21691 21743.9 .129 .345
- r =6 77379 77311.8 .058 .404
- p=1-exp(-SUM/2)= .18278
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 11 to 18
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 995 944.3 2.722 2.722
- r =5 21781 21743.9 .063 2.785
- r =6 77224 77311.8 .100 2.885
- p=1-exp(-SUM/2)= .76366
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 12 to 19
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 961 944.3 .295 .295
- r =5 21477 21743.9 3.276 3.571
- r =6 77562 77311.8 .810 4.381
- p=1-exp(-SUM/2)= .88814
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 13 to 20
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 994 944.3 2.616 2.616
- r =5 21758 21743.9 .009 2.625
- r =6 77248 77311.8 .053 2.677
- p=1-exp(-SUM/2)= .73782
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 14 to 21
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 964 944.3 .411 .411
- r =5 21621 21743.9 .695 1.106
- r =6 77415 77311.8 .138 1.243
- p=1-exp(-SUM/2)= .46295
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 15 to 22
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 959 944.3 .229 .229
- r =5 21780 21743.9 .060 .289
- r =6 77261 77311.8 .033 .322
- p=1-exp(-SUM/2)= .14876
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 16 to 23
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 952 944.3 .063 .063
- r =5 21619 21743.9 .717 .780
- r =6 77429 77311.8 .178 .958
- p=1-exp(-SUM/2)= .38056
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 17 to 24
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 968 944.3 .595 .595
- r =5 21760 21743.9 .012 .607
- r =6 77272 77311.8 .020 .627
- p=1-exp(-SUM/2)= .26918
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 18 to 25
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 922 944.3 .527 .527
- r =5 21906 21743.9 1.208 1.735
- r =6 77172 77311.8 .253 1.988
- p=1-exp(-SUM/2)= .62990
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 19 to 26
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 993 944.3 2.511 2.511
- r =5 21786 21743.9 .082 2.593
- r =6 77221 77311.8 .107 2.700
- p=1-exp(-SUM/2)= .74071
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 20 to 27
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 969 944.3 .646 .646
- r =5 21851 21743.9 .528 1.174
- r =6 77180 77311.8 .225 1.398
- p=1-exp(-SUM/2)= .50298
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 21 to 28
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 965 944.3 .454 .454
- r =5 21790 21743.9 .098 .551
- r =6 77245 77311.8 .058 .609
- p=1-exp(-SUM/2)= .26257
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 22 to 29
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 950 944.3 .034 .034
- r =5 21599 21743.9 .966 1.000
- r =6 77451 77311.8 .251 1.251
- p=1-exp(-SUM/2)= .46490
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 23 to 30
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 947 944.3 .008 .008
- r =5 21709 21743.9 .056 .064
- r =6 77344 77311.8 .013 .077
- p=1-exp(-SUM/2)= .03783
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 24 to 31
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 1007 944.3 4.163 4.163
- r =5 21646 21743.9 .441 4.604
- r =6 77347 77311.8 .016 4.620
- p=1-exp(-SUM/2)= .90073
- Rank of a 6x8 binary matrix,
- rows formed from eight bits of the RNG gcd1_random.dat
- b-rank test for bits 25 to 32
- OBSERVED EXPECTED (O-E)^2/E SUM
- r<=4 913 944.3 1.038 1.038
- r =5 21634 21743.9 .555 1.593
- r =6 77453 77311.8 .258 1.851
- p=1-exp(-SUM/2)= .60365
- TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
- These should be 25 uniform [0,1] random variables:
- .270163 .846456 .927157 .608424 .325030
- .627607 .086490 .858160 .013533 .182780
- .763663 .888145 .737821 .462950 .148757
- .380557 .269178 .629895 .740710 .502976
- .262571 .464903 .037834 .900730 .603646
- brank test summary for gcd1_random.dat
- The KS test for those 25 supposed UNI's yields
- KS p-value= .007880
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: THE BITSTREAM TEST ::
- :: The file under test is viewed as a stream of bits. Call them ::
- :: b1,b2,... . Consider an alphabet with two "letters", 0 and 1 ::
- :: and think of the stream of bits as a succession of 20-letter ::
- :: "words", overlapping. Thus the first word is b1b2...b20, the ::
- :: second is b2b3...b21, and so on. The bitstream test counts ::
- :: the number of missing 20-letter (20-bit) words in a string of ::
- :: 2^21 overlapping 20-letter words. There are 2^20 possible 20 ::
- :: letter words. For a truly random string of 2^21+19 bits, the ::
- :: number of missing words j should be (very close to) normally ::
- :: distributed with mean 141,909 and sigma 428. Thus ::
- :: (j-141909)/428 should be a standard normal variate (z score) ::
- :: that leads to a uniform [0,1) p value. The test is repeated ::
- :: twenty times. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- THE OVERLAPPING 20-tuples BITSTREAM TEST, 20 BITS PER WORD, N words
- This test uses N=2^21 and samples the bitstream 20 times.
- No. missing words should average 141909. with sigma=428.
- ---------------------------------------------------------
- tst no 1: 142137 missing words, .53 sigmas from mean, p-value= .70262
- tst no 2: 142168 missing words, .60 sigmas from mean, p-value= .72720
- tst no 3: 142170 missing words, .61 sigmas from mean, p-value= .72875
- tst no 4: 141696 missing words, -.50 sigmas from mean, p-value= .30909
- tst no 5: 141808 missing words, -.24 sigmas from mean, p-value= .40643
- tst no 6: 141534 missing words, -.88 sigmas from mean, p-value= .19026
- tst no 7: 141567 missing words, -.80 sigmas from mean, p-value= .21190
- tst no 8: 141568 missing words, -.80 sigmas from mean, p-value= .21258
- tst no 9: 141798 missing words, -.26 sigmas from mean, p-value= .39739
- tst no 10: 141920 missing words, .02 sigmas from mean, p-value= .50995
- tst no 11: 141752 missing words, -.37 sigmas from mean, p-value= .35659
- tst no 12: 141840 missing words, -.16 sigmas from mean, p-value= .43566
- tst no 13: 141536 missing words, -.87 sigmas from mean, p-value= .19153
- tst no 14: 142404 missing words, 1.16 sigmas from mean, p-value= .87611
- tst no 15: 142045 missing words, .32 sigmas from mean, p-value= .62437
- tst no 16: 142349 missing words, 1.03 sigmas from mean, p-value= .84785
- tst no 17: 141626 missing words, -.66 sigmas from mean, p-value= .25399
- tst no 18: 141622 missing words, -.67 sigmas from mean, p-value= .25101
- tst no 19: 141848 missing words, -.14 sigmas from mean, p-value= .44303
- tst no 20: 141437 missing words, -1.10 sigmas from mean, p-value= .13489
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: The tests OPSO, OQSO and DNA ::
- :: OPSO means Overlapping-Pairs-Sparse-Occupancy ::
- :: The OPSO test considers 2-letter words from an alphabet of ::
- :: 1024 letters. Each letter is determined by a specified ten ::
- :: bits from a 32-bit integer in the sequence to be tested. OPSO ::
- :: generates 2^21 (overlapping) 2-letter words (from 2^21+1 ::
- :: "keystrokes") and counts the number of missing words---that ::
- :: is 2-letter words which do not appear in the entire sequence. ::
- :: That count should be very close to normally distributed with ::
- :: mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should ::
- :: be a standard normal variable. The OPSO test takes 32 bits at ::
- :: a time from the test file and uses a designated set of ten ::
- :: consecutive bits. It then restarts the file for the next de- ::
- :: signated 10 bits, and so on. ::
- :: ::
- :: OQSO means Overlapping-Quadruples-Sparse-Occupancy ::
- :: The test OQSO is similar, except that it considers 4-letter ::
- :: words from an alphabet of 32 letters, each letter determined ::
- :: by a designated string of 5 consecutive bits from the test ::
- :: file, elements of which are assumed 32-bit random integers. ::
- :: The mean number of missing words in a sequence of 2^21 four- ::
- :: letter words, (2^21+3 "keystrokes"), is again 141909, with ::
- :: sigma = 295. The mean is based on theory; sigma comes from ::
- :: extensive simulation. ::
- :: ::
- :: The DNA test considers an alphabet of 4 letters:: C,G,A,T,::
- :: determined by two designated bits in the sequence of random ::
- :: integers being tested. It considers 10-letter words, so that ::
- :: as in OPSO and OQSO, there are 2^20 possible words, and the ::
- :: mean number of missing words from a string of 2^21 (over- ::
- :: lapping) 10-letter words (2^21+9 "keystrokes") is 141909. ::
- :: The standard deviation sigma=339 was determined as for OQSO ::
- :: by simulation. (Sigma for OPSO, 290, is the true value (to ::
- :: three places), not determined by simulation. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- OPSO test for generator gcd1_random.dat
- Output: No. missing words (mw), equiv normal variate (z), p-value (p)
- mw z p
- OPSO for gcd1_random.dat using bits 23 to 32 141980 .244 .5963
- OPSO for gcd1_random.dat using bits 22 to 31 141549 -1.243 .1070
- OPSO for gcd1_random.dat using bits 21 to 30 141818 -.315 .3764
- OPSO for gcd1_random.dat using bits 20 to 29 141760 -.515 .3033
- OPSO for gcd1_random.dat using bits 19 to 28 141739 -.587 .2785
- OPSO for gcd1_random.dat using bits 18 to 27 142074 .568 .7149
- OPSO for gcd1_random.dat using bits 17 to 26 141844 -.225 .4109
- OPSO for gcd1_random.dat using bits 16 to 25 142007 .337 .6319
- OPSO for gcd1_random.dat using bits 15 to 24 141787 -.422 .3366
- OPSO for gcd1_random.dat using bits 14 to 23 142184 .947 .8282
- OPSO for gcd1_random.dat using bits 13 to 22 142029 .413 .6601
- OPSO for gcd1_random.dat using bits 12 to 21 141733 -.608 .2716
- OPSO for gcd1_random.dat using bits 11 to 20 141979 .240 .5949
- OPSO for gcd1_random.dat using bits 10 to 19 142099 .654 .7435
- OPSO for gcd1_random.dat using bits 9 to 18 141915 .020 .5078
- OPSO for gcd1_random.dat using bits 8 to 17 142203 1.013 .8444
- OPSO for gcd1_random.dat using bits 7 to 16 141334 -1.984 .0236
- OPSO for gcd1_random.dat using bits 6 to 15 141742 -.577 .2820
- OPSO for gcd1_random.dat using bits 5 to 14 141868 -.143 .4433
- OPSO for gcd1_random.dat using bits 4 to 13 141703 -.711 .2384
- OPSO for gcd1_random.dat using bits 3 to 12 141685 -.774 .2196
- OPSO for gcd1_random.dat using bits 2 to 11 141906 -.011 .4954
- OPSO for gcd1_random.dat using bits 1 to 10 142081 .592 .7231
- OQSO test for generator gcd1_random.dat
- Output: No. missing words (mw), equiv normal variate (z), p-value (p)
- mw z p
- OQSO for gcd1_random.dat using bits 28 to 32 142275 1.240 .8924
- OQSO for gcd1_random.dat using bits 27 to 31 142247 1.145 .8738
- OQSO for gcd1_random.dat using bits 26 to 30 142029 .406 .6575
- OQSO for gcd1_random.dat using bits 25 to 29 142425 1.748 .9598
- OQSO for gcd1_random.dat using bits 24 to 28 141643 -.903 .1833
- OQSO for gcd1_random.dat using bits 23 to 27 141824 -.289 .3862
- OQSO for gcd1_random.dat using bits 22 to 26 141925 .053 .5212
- OQSO for gcd1_random.dat using bits 21 to 25 141871 -.130 .4483
- OQSO for gcd1_random.dat using bits 20 to 24 141897 -.042 .4833
- OQSO for gcd1_random.dat using bits 19 to 23 141486 -1.435 .0756
- OQSO for gcd1_random.dat using bits 18 to 22 141980 .240 .5947
- OQSO for gcd1_random.dat using bits 17 to 21 141736 -.588 .2784
- OQSO for gcd1_random.dat using bits 16 to 20 141608 -1.021 .1535
- OQSO for gcd1_random.dat using bits 15 to 19 141701 -.706 .2400
- OQSO for gcd1_random.dat using bits 14 to 18 141728 -.615 .2694
- OQSO for gcd1_random.dat using bits 13 to 17 142251 1.158 .8766
- OQSO for gcd1_random.dat using bits 12 to 16 141719 -.645 .2594
- OQSO for gcd1_random.dat using bits 11 to 15 142125 .731 .7676
- OQSO for gcd1_random.dat using bits 10 to 14 141691 -.740 .2296
- OQSO for gcd1_random.dat using bits 9 to 13 142155 .833 .7975
- OQSO for gcd1_random.dat using bits 8 to 12 141833 -.259 .3979
- OQSO for gcd1_random.dat using bits 7 to 11 141795 -.388 .3492
- OQSO for gcd1_random.dat using bits 6 to 10 141855 -.184 .4269
- OQSO for gcd1_random.dat using bits 5 to 9 141822 -.296 .3836
- OQSO for gcd1_random.dat using bits 4 to 8 142281 1.260 .8961
- OQSO for gcd1_random.dat using bits 3 to 7 142204 .999 .8411
- OQSO for gcd1_random.dat using bits 2 to 6 141833 -.259 .3979
- OQSO for gcd1_random.dat using bits 1 to 5 142030 .409 .6588
- DNA test for generator gcd1_random.dat
- Output: No. missing words (mw), equiv normal variate (z), p-value (p)
- mw z p
- DNA for gcd1_random.dat using bits 31 to 32 142061 .447 .6727
- DNA for gcd1_random.dat using bits 30 to 31 142300 1.152 .8754
- DNA for gcd1_random.dat using bits 29 to 30 142425 1.521 .9359
- DNA for gcd1_random.dat using bits 28 to 29 141880 -.087 .4655
- DNA for gcd1_random.dat using bits 27 to 28 142079 .501 .6916
- DNA for gcd1_random.dat using bits 26 to 27 141236 -1.986 .0235
- DNA for gcd1_random.dat using bits 25 to 26 142048 .409 .6588
- DNA for gcd1_random.dat using bits 24 to 25 141969 .176 .5699
- DNA for gcd1_random.dat using bits 23 to 24 142704 2.344 .9905
- DNA for gcd1_random.dat using bits 22 to 23 141436 -1.396 .0813
- DNA for gcd1_random.dat using bits 21 to 22 142090 .533 .7030
- DNA for gcd1_random.dat using bits 20 to 21 142312 1.188 .8825
- DNA for gcd1_random.dat using bits 19 to 20 141991 .241 .5952
- DNA for gcd1_random.dat using bits 18 to 19 142139 .677 .7510
- DNA for gcd1_random.dat using bits 17 to 18 141882 -.081 .4679
- DNA for gcd1_random.dat using bits 16 to 17 141704 -.606 .2724
- DNA for gcd1_random.dat using bits 15 to 16 141578 -.977 .1642
- DNA for gcd1_random.dat using bits 14 to 15 141481 -1.264 .1032
- DNA for gcd1_random.dat using bits 13 to 14 142005 .282 .6111
- DNA for gcd1_random.dat using bits 12 to 13 141628 -.830 .2033
- DNA for gcd1_random.dat using bits 11 to 12 141828 -.240 .4052
- DNA for gcd1_random.dat using bits 10 to 11 141181 -2.148 .0158
- DNA for gcd1_random.dat using bits 9 to 10 142123 .630 .7358
- DNA for gcd1_random.dat using bits 8 to 9 142247 .996 .8404
- DNA for gcd1_random.dat using bits 7 to 8 142601 2.040 .9793
- DNA for gcd1_random.dat using bits 6 to 7 142088 .527 .7009
- DNA for gcd1_random.dat using bits 5 to 6 142012 .303 .6190
- DNA for gcd1_random.dat using bits 4 to 5 141730 -.529 .2984
- DNA for gcd1_random.dat using bits 3 to 4 142036 .374 .6457
- DNA for gcd1_random.dat using bits 2 to 3 142232 .952 .8294
- DNA for gcd1_random.dat using bits 1 to 2 141973 .188 .5745
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the COUNT-THE-1's TEST on a stream of bytes. ::
- :: Consider the file under test as a stream of bytes (four per ::
- :: 32 bit integer). Each byte can contain from 0 to 8 1's, ::
- :: with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let ::
- :: the stream of bytes provide a string of overlapping 5-letter ::
- :: words, each "letter" taking values A,B,C,D,E. The letters are ::
- :: determined by the number of 1's in a byte:: 0,1,or 2 yield A,::
- :: 3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus ::
- :: we have a monkey at a typewriter hitting five keys with vari- ::
- :: ous probabilities (37,56,70,56,37 over 256). There are 5^5 ::
- :: possible 5-letter words, and from a string of 256,000 (over- ::
- :: lapping) 5-letter words, counts are made on the frequencies ::
- :: for each word. The quadratic form in the weak inverse of ::
- :: the covariance matrix of the cell counts provides a chisquare ::
- :: test:: Q5-Q4, the difference of the naive Pearson sums of ::
- :: (OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Test results for gcd1_random.dat
- Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000
- chisquare equiv normal p-value
- Results fo COUNT-THE-1's in successive bytes:
- byte stream for gcd1_random.dat 2532.72 .463 .678232
- byte stream for gcd1_random.dat 2569.44 .982 .836941
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the COUNT-THE-1's TEST for specific bytes. ::
- :: Consider the file under test as a stream of 32-bit integers. ::
- :: From each integer, a specific byte is chosen , say the left- ::
- :: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's, ::
- :: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let ::
- :: the specified bytes from successive integers provide a string ::
- :: of (overlapping) 5-letter words, each "letter" taking values ::
- :: A,B,C,D,E. The letters are determined by the number of 1's, ::
- :: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,::
- :: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter ::
- :: hitting five keys with with various probabilities:: 37,56,70,::
- :: 56,37 over 256. There are 5^5 possible 5-letter words, and ::
- :: from a string of 256,000 (overlapping) 5-letter words, counts ::
- :: are made on the frequencies for each word. The quadratic form ::
- :: in the weak inverse of the covariance matrix of the cell ::
- :: counts provides a chisquare test:: Q5-Q4, the difference of ::
- :: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5- ::
- :: and 4-letter cell counts. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000
- chisquare equiv normal p value
- Results for COUNT-THE-1's in specified bytes:
- bits 1 to 8 2492.27 -.109 .456454
- bits 2 to 9 2511.29 .160 .563450
- bits 3 to 10 2318.75 -2.563 .005184
- bits 4 to 11 2528.76 .407 .657899
- bits 5 to 12 2603.12 1.458 .927623
- bits 6 to 13 2557.80 .817 .793159
- bits 7 to 14 2528.91 .409 .658666
- bits 8 to 15 2463.30 -.519 .301885
- bits 9 to 16 2427.14 -1.030 .151401
- bits 10 to 17 2484.04 -.226 .410695
- bits 11 to 18 2428.50 -1.011 .155970
- bits 12 to 19 2608.19 1.530 .936995
- bits 13 to 20 2508.85 .125 .549778
- bits 14 to 21 2459.67 -.570 .284205
- bits 15 to 22 2354.49 -2.058 .019806
- bits 16 to 23 2552.84 .747 .772541
- bits 17 to 24 2532.61 .461 .677651
- bits 18 to 25 2559.94 .848 .801675
- bits 19 to 26 2424.52 -1.067 .142892
- bits 20 to 27 2506.13 .087 .534537
- bits 21 to 28 2509.23 .130 .551901
- bits 22 to 29 2443.94 -.793 .213932
- bits 23 to 30 2455.85 -.624 .266171
- bits 24 to 31 2464.99 -.495 .310279
- bits 25 to 32 2451.96 -.679 .248435
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: THIS IS A PARKING LOT TEST ::
- :: In a square of side 100, randomly "park" a car---a circle of ::
- :: radius 1. Then try to park a 2nd, a 3rd, and so on, each ::
- :: time parking "by ear". That is, if an attempt to park a car ::
- :: causes a crash with one already parked, try again at a new ::
- :: random location. (To avoid path problems, consider parking ::
- :: helicopters rather than cars.) Each attempt leads to either ::
- :: a crash or a success, the latter followed by an increment to ::
- :: the list of cars already parked. If we plot n: the number of ::
- :: attempts, versus k:: the number successfully parked, we get a::
- :: curve that should be similar to those provided by a perfect ::
- :: random number generator. Theory for the behavior of such a ::
- :: random curve seems beyond reach, and as graphics displays are ::
- :: not available for this battery of tests, a simple characteriz ::
- :: ation of the random experiment is used: k, the number of cars ::
- :: successfully parked after n=12,000 attempts. Simulation shows ::
- :: that k should average 3523 with sigma 21.9 and is very close ::
- :: to normally distributed. Thus (k-3523)/21.9 should be a st- ::
- :: andard normal variable, which, converted to a uniform varia- ::
- :: ble, provides input to a KSTEST based on a sample of 10. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- CDPARK: result of ten tests on file gcd1_random.dat
- Of 12,000 tries, the average no. of successes
- should be 3523 with sigma=21.9
- Successes: 3526 z-score: .137 p-value: .554479
- Successes: 3547 z-score: 1.096 p-value: .863437
- Successes: 3545 z-score: 1.005 p-value: .842447
- Successes: 3514 z-score: -.411 p-value: .340551
- Successes: 3580 z-score: 2.603 p-value: .995376
- Successes: 3541 z-score: .822 p-value: .794438
- Successes: 3527 z-score: .183 p-value: .572463
- Successes: 3491 z-score: -1.461 p-value: .071982
- Successes: 3559 z-score: 1.644 p-value: .949895
- Successes: 3508 z-score: -.685 p-value: .246694
- square size avg. no. parked sample sigma
- 100. 3533.800 24.722
- KSTEST for the above 10: p= .771386
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: THE MINIMUM DISTANCE TEST ::
- :: It does this 100 times:: choose n=8000 random points in a ::
- :: square of side 10000. Find d, the minimum distance between ::
- :: the (n^2-n)/2 pairs of points. If the points are truly inde- ::
- :: pendent uniform, then d^2, the square of the minimum distance ::
- :: should be (very close to) exponentially distributed with mean ::
- :: .995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and ::
- :: a KSTEST on the resulting 100 values serves as a test of uni- ::
- :: formity for random points in the square. Test numbers=0 mod 5 ::
- :: are printed but the KSTEST is based on the full set of 100 ::
- :: random choices of 8000 points in the 10000x10000 square. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- This is the MINIMUM DISTANCE test
- for random integers in the file gcd1_random.dat
- Sample no. d^2 avg equiv uni
- 5 .2110 .5529 .191071
- 10 .1822 .4946 .167294
- 15 2.0950 .7466 .878215
- 20 1.2951 .7297 .727898
- 25 .2933 .7646 .255316
- 30 .4497 .9681 .363625
- 35 1.2274 .9661 .708757
- 40 .0228 1.0578 .022679
- 45 .2460 1.0682 .219077
- 50 .7823 1.0286 .544460
- 55 .4192 1.0102 .343834
- 60 .5085 1.0842 .400110
- 65 .4174 1.0485 .342592
- 70 1.1765 1.0658 .693449
- 75 .8447 1.0524 .572146
- 80 .3917 1.0334 .325447
- 85 1.3140 1.0794 .733020
- 90 .5307 1.1127 .413352
- 95 2.0993 1.1043 .878740
- 100 3.9393 1.1266 .980919
- MINIMUM DISTANCE TEST for gcd1_random.dat
- Result of KS test on 20 transformed mindist^2's:
- p-value= .905706
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: THE 3DSPHERES TEST ::
- :: Choose 4000 random points in a cube of edge 1000. At each ::
- :: point, center a sphere large enough to reach the next closest ::
- :: point. Then the volume of the smallest such sphere is (very ::
- :: close to) exponentially distributed with mean 120pi/3. Thus ::
- :: the radius cubed is exponential with mean 30. (The mean is ::
- :: obtained by extensive simulation). The 3DSPHERES test gener- ::
- :: ates 4000 such spheres 20 times. Each min radius cubed leads ::
- :: to a uniform variable by means of 1-exp(-r^3/30.), then a ::
- :: KSTEST is done on the 20 p-values. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- The 3DSPHERES test for file gcd1_random.dat
- sample no: 1 r^3= 47.629 p-value= .79559
- sample no: 2 r^3= 70.926 p-value= .90598
- sample no: 3 r^3= 34.603 p-value= .68444
- sample no: 4 r^3= 2.972 p-value= .09430
- sample no: 5 r^3= 11.322 p-value= .31436
- sample no: 6 r^3= 24.203 p-value= .55369
- sample no: 7 r^3= 21.796 p-value= .51642
- sample no: 8 r^3= 7.582 p-value= .22332
- sample no: 9 r^3= 80.985 p-value= .93276
- sample no: 10 r^3= 4.670 p-value= .14415
- sample no: 11 r^3= 64.123 p-value= .88204
- sample no: 12 r^3= 2.611 p-value= .08335
- sample no: 13 r^3= 56.412 p-value= .84747
- sample no: 14 r^3= 13.879 p-value= .37038
- sample no: 15 r^3= 2.981 p-value= .09458
- sample no: 16 r^3= 130.525 p-value= .98710
- sample no: 17 r^3= 99.077 p-value= .96321
- sample no: 18 r^3= 50.667 p-value= .81528
- sample no: 19 r^3= 26.643 p-value= .58857
- sample no: 20 r^3= 35.892 p-value= .69772
- A KS test is applied to those 20 p-values.
- ---------------------------------------------------------
- 3DSPHERES test for file gcd1_random.dat p-value= .700030
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the SQEEZE test ::
- :: Random integers are floated to get uniforms on [0,1). Start- ::
- :: ing with k=2^31=2147483647, the test finds j, the number of ::
- :: iterations necessary to reduce k to 1, using the reduction ::
- :: k=ceiling(k*U), with U provided by floating integers from ::
- :: the file being tested. Such j's are found 100,000 times, ::
- :: then counts for the number of times j was <=6,7,...,47,>=48 ::
- :: are used to provide a chi-square test for cell frequencies. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- RESULTS OF SQUEEZE TEST FOR gcd1_random.dat
- Table of standardized frequency counts
- ( (obs-exp)/sqrt(exp) )^2
- for j taking values <=6,7,8,...,47,>=48:
- -.1 -.3 .6 .8 1.1 .0
- -.7 -.1 -.2 .6 -.1 -.8
- -1.3 -.2 -.6 .4 1.0 -.6
- -.3 -1.3 .1 1.4 .2 1.3
- -.1 -.5 -.4 .2 1.9 .7
- 1.2 -.7 -.9 1.7 1.9 -.1
- -.9 -.1 .1 -1.8 .1 1.0
- -.1
- Chi-square with 42 degrees of freedom: 31.987
- z-score= -1.093 p-value= .131288
- ______________________________________________________________
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: The OVERLAPPING SUMS test ::
- :: Integers are floated to get a sequence U(1),U(2),... of uni- ::
- :: form [0,1) variables. Then overlapping sums, ::
- :: S(1)=U(1)+...+U(100), S2=U(2)+...+U(101),... are formed. ::
- :: The S's are virtually normal with a certain covariance mat- ::
- :: rix. A linear transformation of the S's converts them to a ::
- :: sequence of independent standard normals, which are converted ::
- :: to uniform variables for a KSTEST. The p-values from ten ::
- :: KSTESTs are given still another KSTEST. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Test no. 1 p-value .806701
- Test no. 2 p-value .470101
- Test no. 3 p-value .348392
- Test no. 4 p-value .196140
- Test no. 5 p-value .011140
- Test no. 6 p-value .267222
- Test no. 7 p-value .568066
- Test no. 8 p-value .929084
- Test no. 9 p-value .142401
- Test no. 10 p-value .239075
- Results of the OSUM test for gcd1_random.dat
- KSTEST on the above 10 p-values: .551882
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the RUNS test. It counts runs up, and runs down, ::
- :: in a sequence of uniform [0,1) variables, obtained by float- ::
- :: ing the 32-bit integers in the specified file. This example ::
- :: shows how runs are counted: .123,.357,.789,.425,.224,.416,.95::
- :: contains an up-run of length 3, a down-run of length 2 and an ::
- :: up-run of (at least) 2, depending on the next values. The ::
- :: covariance matrices for the runs-up and runs-down are well ::
- :: known, leading to chisquare tests for quadratic forms in the ::
- :: weak inverses of the covariance matrices. Runs are counted ::
- :: for sequences of length 10,000. This is done ten times. Then ::
- :: repeated. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- The RUNS test for file gcd1_random.dat
- Up and down runs in a sample of 10000
- _________________________________________________
- Run test for gcd1_random.dat:
- runs up; ks test for 10 p's: .533980
- runs down; ks test for 10 p's: .563354
- Run test for gcd1_random.dat:
- runs up; ks test for 10 p's: .103345
- runs down; ks test for 10 p's: .287414
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: This is the CRAPS TEST. It plays 200,000 games of craps, finds::
- :: the number of wins and the number of throws necessary to end ::
- :: each game. The number of wins should be (very close to) a ::
- :: normal with mean 200000p and variance 200000p(1-p), with ::
- :: p=244/495. Throws necessary to complete the game can vary ::
- :: from 1 to infinity, but counts for all>21 are lumped with 21. ::
- :: A chi-square test is made on the no.-of-throws cell counts. ::
- :: Each 32-bit integer from the test file provides the value for ::
- :: the throw of a die, by floating to [0,1), multiplying by 6 ::
- :: and taking 1 plus the integer part of the result. ::
- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- Results of craps test for gcd1_random.dat
- No. of wins: Observed Expected
- 98604 98585.86
- 98604= No. of wins, z-score= .081 pvalue= .53233
- Analysis of Throws-per-Game:
- Chisq= 15.69 for 20 degrees of freedom, p= .26415
- Throws Observed Expected Chisq Sum
- 1 66538 66666.7 .248 .248
- 2 37657 37654.3 .000 .249
- 3 26938 26954.7 .010 .259
- 4 19422 19313.5 .610 .869
- 5 13905 13851.4 .207 1.076
- 6 9928 9943.5 .024 1.100
- 7 7215 7145.0 .685 1.786
- 8 5203 5139.1 .795 2.581
- 9 3720 3699.9 .110 2.691
- 10 2605 2666.3 1.409 4.100
- 11 1953 1923.3 .458 4.558
- 12 1329 1388.7 2.570 7.127
- 13 1013 1003.7 .086 7.213
- 14 708 726.1 .453 7.666
- 15 496 525.8 1.693 9.359
- 16 410 381.2 2.184 11.543
- 17 262 276.5 .764 12.307
- 18 183 200.8 1.583 13.890
- 19 131 146.0 1.538 15.428
- 20 102 106.2 .167 15.596
- 21 282 287.1 .091 15.687
- SUMMARY FOR gcd1_random.dat
- p-value for no. of wins: .532333
- p-value for throws/game: .264147
- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- Results of DIEHARD battery of tests sent to file GCD1_report.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement