Simulation and modeling - Old Questions

Question Answer Details

3.  Define frequency test for random numbers. Develop the Poker test for four digit numbers, and use it to test whether a sequence of following 1000-four digit numbers are independent. [2+4+4]

(Use Use α=0.05 and N=4 is 9.49)

Combination(i)

Observed frequency (Oi)

Four different digits

565

One pair

392

Two pairs

17

Three like digits

24

Four like digits

2

 

1000

10 marks
Asked in 2072

Answer

AI Generated Answer

AI is thinking...

Official Answer

Frequency test uses the Kolmogorov-Smirnov or the chi-square test to compare the distribution of the set of numbers generated to a uniform distribution.

The Poker Test is the test for independence based on the frequency with which certain digits are repeated with in a series of numbers. This test not only tests for the randomness of the sequence of numbers, but also the digits comprising of each of the numbers. The expected value of each of the combination of digits in a number is compared with the observed value by means of the chi-square test for independence. The acceptance is done if the observed value of chi-square sums for all the possible combinations of digits is less than the acceptable value for the given degree of freedom at the specified confidence interval.

Poker test for four digit numbers

In four digit number, there are five different possibilities

  • All individual digits can be different
  • There can be one pair of like digit
  • There can be two pair of like digits
  • There can be three digits of a kind
  • There can be four digits of a kind

The probabilities associated with each of the possibilities is given by

P (four different digits) = 4C4 * (10/10) * (9/10) * (8/10) * (7/10) = 0.504

P (one pair) = 4C2 * (10/10) * (1/10) * (9/10) * (8/10) = 0.432

P (two pair) = (4C2/2)*(10/10) * (1/10) * (9/10) * (1/10) = 0.027

P (three digits of a kind) = 4C3 * (10/10) * (1/10) * (1/10) * (9/10) = 0.036

P (four digits of a kind) = 4C4 * (10/10) * (1/10) * (1/10) * (1/10) = 0.001

Now the calculation table for the Chi-square statistics is:

Combination(i)

Observed

Frequency(Oi)

Expected

Frequency(Ei)

(Oi-Ei)(Oi-Ei)2/Ei
Four different digits5650.504*1000 = 504
617.383
One pair3920.432*1000 = 432
-403.704
Two pair17 0.027*1000 = 27
-103.704
Three digits of a kind240.036*1000 = 36
-124.000
Four digits of a kind2 0.001*1000 = 1
11

10001000
Σ(Oi-Ei)2/Ei = 19.791

\\begin{displaymath}x_0^2 = \\sum_{i=1}^n \\frac{(O_i - E_i)^2} {E_i} \\end{displaymath} = 19.791

and Given  α, N = 0.05, 4= 9.49

Here the calculated value of chi-square is 19.791 which is greater than the given tabulated value of chi- square so we reject the null hypothesis of independence between given numbers.