Next: Runs Tests Up: Tests for Random Numbers Previous: Tests for Random Numbers

## Frequency test

• The frequency test is a test of uniformity.
• Two different methods available, Kolmogorov-Smirnov test and the chi-square test. Both tests measure the agreement between the distribution of a sample of generated random numbers and the theoretical uniform distribution.
• Both tests are based on the null hypothesis of no significant difference between the sample distribution and the theoretical distribution.

The Kolmogorov-Smirnov test
This test compares the cdf of uniform distribution F(x) to the empirical cdf of the sample of N observations.

• As N becomes larger, should be close to F(x)
• Kolmogorov-Smirnov test is based on the statistic

that is the absolute value of the differences.
• Here D is a random variable, its sampling distribution is tabulated in Table A.8.
• If the calcualted D value is greater than the ones listed in the Table, the hypothesis (no disagreement between the samples and the theoretical value) should be rejected; otherwise, we don't have enough information to reject it.

• Following steps are taken to perform the test.
1. Rank the data from smallest to largest

2. Compute

3. Compute
4. Determine the critical value, , from Table A.8 for the specified significance level and the given sample size N.
5. If the sample statistic D is greater than the critical value , the null hypothsis that the sample data is from a uniform distribution is rejected; if , then there is no evidence to reject it.
• Example 8.6 on page 300.

Chi-Square test
The chi-square test looks at the issue from the same angle but uses different method. Instead of measure the difference of each point between the samples and the true distribution, chi-square checks the deviation'' from the expected'' value.

where n is the number of classes (e.g. intervals), is the number of samples obseved in the interval, is expected number of samples in the interval. If the sample size is N, in a uniform distribution,

See Example 8.7 on page 302.

Next: Runs Tests Up: Tests for Random Numbers Previous: Tests for Random Numbers
Meng Xiannong 2002-10-18