2. Contents:
-> Random numbers??
-> True and pseudo random??
-> Main properties of pseudo random .
-> Kolmogorov-Smirnov?
-> Why Kolmogorov-Smirnov?
3. Random numbers
Sequence of numbers or symbols that cannot be
reasonably predicted better than by a random chance.
True Random
Random number sequence that has no chance of
being predicted.
Pseudo Random
Random number sequence that has some chance of
being predicted.
4. Properties of pseudo random number
-> Dependent
-> Uniformity
-> Deterministic
-> Tractable
5. Kolmogorov-Smirnov Test
-> Used to test the uniformity of the given sequence.
-> Compares the continuous cdf, F(X), of the uniform
distribution to the empirical cdf, SN(x), of the sample of N
observations.
-> Based on the statistic
D = max | F(x) - SN(x)|
6. Algorithm:
• Step 1: Rank the data from smallest to largest. Let Ri denote ith
smallest observation, so that R 1 <=R 2 <=R 3 <= ...<=R N
• Step2: Compute D+ = max {i/N –Ri} and D-= max {Ri –(i-1)/N}
• Step 3: Find D = max {D+, D-}
• Step 4: Determine the critical value, Dα, from Table for the specified
value of α and the sample size N.
• Step 5: If the sample statistic D is greater than the tabulated value of
Dα, the null hypothesis that the data are a sample from uniform
distribution is rejected
7. Example
Give Numbers: 0.05, 0.14, 0.44, 0.81, 0.92.
Critical value of D for α = 0.05 and for N=5 is 0.565.
Now,
D+ = max(D+) = 0.26
D- = max(D-) = 0.21
So, D = max (D+, D-) = 0.26.
From tabulated value, D=0.565, i.e. greater than 0.26 (observed).
So, the hypothesis, no difference between the distribution of the generated number are the uniform
distribution is nor rejected. i.e. Accepted.
Ri 0.05 0.14 0.44 0.81 0.92
i/N 0.2 0.4 0.6 0.8 1.0
i/N-Ri (D+) 0.15 0.26 0.16 -0.01 0.07
Ri-(i-1)/N (D-) 0.05 -0.06 0.04 0.21 0.13
8. Conclusion:
• K-S test can be only applied to pseudo random numbers.
• Used to find whether the sequence is uniformly distributed or not
• Based on the statistic
D = max | F(x) - SN(x)|