randomness test fall 2012 by yaohang li, ph.d.. review last class –random number generation...
TRANSCRIPT
Randomness Test
Fall 2012
By Yaohang Li, Ph.D.
Review• Last Class
– Random Number Generation– Uniform Distribution
• This Class– Test of Randomness– Chi Square Test– K-S Test– 10 empirical tests
• Next Class– Nuclear Simulation
Chi-square test
• Introduced by Karl Pearson in 1900• Test for discrete distributions e.g. binomial and Poisson distributions• Implementation: - assume we have k possible categories - P = sequence size / k - expected sample size = P * n trials - suppose category i occurs Yi times - error = Yi – nPi
- chi-square statistic - chi-square percentile = proportion of samples from a "true“ distribution
having a chi-square statistic (function of errors) less than the percentile.
Example
• Given two “true” dice for 144 trials we get:
• s = 2 3 4 5 6 7 8 9 10 11 12• Ps = 1/36 1/18 1/12 1/9 5/36 1/6 5/36 1/9 1/12 1/18 1/36• Ys = 2 4 10 12 22 29 21 15 14 9 6 • nPs = 4 8 12 16 20 24 20 16 12 8 4
• V = (Y2 – nP2)² / nP2 + (Y3 – nP3)² / nP3 +………+ (Y12 – nP12)² / nP12
• V = (2 – 4)² / 4 + (4 – 8)² / 8 +……+ (9 – 8)² / 8 + (6 – 4)² / 4 = 7 7/48
Chi-square Table
Kolmogorov-Smirnov test
• Introduced in 1933• Test for continuous distributions e.g. normal and Weibull
distributions• based on ECDF defined as,
K-S Test
K-S Table
Empirical Tests
• Equidistribution Test• Serial Test• Gap Test• Poker Test• Coupon Collector’s Test• Permutation Test• Run Test• Maximum of t test• Collision Test• Serial Correlation Test
Summary• Chi-Square Test• KS Test• Empirical Tests
What I want you to do?
• Review Slides• Review basic probability/statistics concepts• Work on your Assignment 3