1 / 10

Test for randomness : Chi square test

Test for randomness : Chi square test. We can say how probable or improbable certain types of events are. The difference between observed Y s and expected np s V = (Y 2 – np 2 ) 2 + (Y 3 – np 3 ) 2 + … + (Y 12 – np 12 ) 2 What is the probability what V is this high using true dice?.

layne
Download Presentation

Test for randomness : Chi square test

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. Test for randomness : Chi square test We can say how probable or improbable certain types of events are. The difference between observed Ys and expected nps V = (Y2 – np2) 2 + (Y3 – np3) 2 + … + (Y12 – np12) 2 What is the probability what V is this high using true dice? Prabhas Chongstitvatana

  2. Suppose that every observation can fall into one of k categories. We take n independent observations. Let ps be the probability that each observation falls into category s, and let Ys be the number of observations that actually do fall into category s. Weighted by the prob. of occurrence nps Prabhas Chongstitvatana

  3. Expanding (Ys – nps) 2 = Y2 – 2nps Ys + n2 ps2 and Y1 + Y2 + … Yk = n p1 + p2 + … pk = 1 v = k –1 the number of degree of freedom is k – 1. Prabhas Chongstitvatana

  4. Chi-square distribution table says “The quantity V will be less than or equal to x with approximate probability p, if n is large enough”. How large should n be? Rule of thumb is nps>= 5 Prabhas Chongstitvatana

  5. Example five Chi-square test on three data of four generators. Prabhas Chongstitvatana

  6. B : x0 = 0, a = 3141592653, c = 2718281829, m = 2 35 C : x0 = 0, a = 2 7 + 1 , c = 1, m = 2 35 D : x0 = 47194118, a = 23, c = 0, m = 10 8 + 1 F : x0 = 314159265, a = 2 18 + 1, c = 1, m = 2 35 Conclusion, B and D are satisfactory, C is on the borderline, F is unsatisfactory. Prabhas Chongstitvatana

  7. Other tests Kolmogorov-Smirnov test (available in SPSS package) Frequency test, serial test, gap test, Poker test (partition test), Coupon’s collector test, permutation test, run test, maximum-of-t test, collision test, serial correlation test, tests on subsequences Spectral test Prabhas Chongstitvatana

  8. Advise for RNG The seed number X0 may be chosen arbitrarily. The number m should be large. The computation (aX + c) mod m must be done exactly with no roundoff error. If m is the power of 2, pick a so that a mod 8 = 5 to ensure max period and high potency. Prabhas Chongstitvatana

  9. The muliplier a should preferably be chosen between .01m and .99m and is binary digits should not have a simple, regular pattern. The value of c is immaterial when a is a good multiplier, except that c must be no factor in common with m. The least significant (right-handed) digits of X are not very random. It is generally best to think of X as a random fraction X/m between 0 and 1. Prabhas Chongstitvatana

  10. Some good RNG a, m 137, 256 3141592221, 235 5 15, 2 35 17059465, 2 35 1664525, 2 32 314159269, 2 31 - 1 31167285, 2 48 6364136223846793005, 2 64 Prabhas Chongstitvatana

More Related