randomness test fall 2012 by yaohang li, ph.d.. review last class –random number generation...

11
Randomness Test Fall 2012 By Yaohang Li, Ph.D.

Upload: marian-neal

Post on 05-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

Randomness Test

Fall 2012

By Yaohang Li, Ph.D.

Page 2: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

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

Page 3: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

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.

Page 4: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

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

Page 5: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

Chi-square Table

Page 6: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

Kolmogorov-Smirnov test

• Introduced in 1933• Test for continuous distributions e.g. normal and Weibull

distributions• based on ECDF defined as,

Page 7: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

K-S Test

Page 8: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

K-S Table

Page 9: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

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

Page 10: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

Summary• Chi-Square Test• KS Test• Empirical Tests

Page 11: Randomness Test Fall 2012 By Yaohang Li, Ph.D.. Review Last Class –Random Number Generation –Uniform Distribution This Class –Test of Randomness –Chi

What I want you to do?

• Review Slides• Review basic probability/statistics concepts• Work on your Assignment 3