## Poker Test – Test for independence in Randomness

Simulation and Modeling Reference Notes

Fifth Semester | Third year

BSc.CSIT | Tribhuvan University (TU)

**Poker Test**

The poker test for independence is based on the frequency with which certain digits are repeated in a series of numbers. The following example shows an unusual amount of repetition:

0.255, 0.577, 0.331, 0.414, 0.828, 0.909, 0.303, 0.001,…..

The poker test uses the chi square statistics to accept or reject the null hypothesis.

In each case, a pair of like digits appears in the number that was generated. In three-digit numbers there are only three possibilities, as follows:

- The individual numbers can all be different.
- The individual numbers can all be the same.
- There can be one pair of like digits.

The probability associated with each of these possibilities is given by the following

- P (three different digits) = P (second different from the first) x P (third different from the first and second) = (0.9) *(0.8) = 0.72
- P (three like digits) = P (second digit same as the first) x P (third digit same as the first) = (0.1)* (0.1) = 0.01
- P (exactly one pair) = 1 – 0.72 – 0.01 = 0.27

**Example 1 : (For three digit numbers)**

A sequence of 1000 three-digit numbers has been generated and an analysis indicates that 680 have three different digits, 289 contain exactly one pair of like digits, and 31 contain three like digits. Based on the poker test, are these numbers independent? Let a = 0.05. Test these numbers using poker test for three digit.

**Solution:**

The test is summarized in table below;

The appropriate degrees of freedom are one less than the number of class intervals. Since 47.65 > X^{2}_{0.05}, 2= 5.99 (tabulated value), the independence of the numbers is rejected on the basis of this test. Here 2 or n-1 is the degree of freedom since there are only 3 (n) class.

**Example 2 : (For four digit numbers)**

Explain the independence test. A sequence of 1000 four digit numbers has been generated and an analysis indicates the following combinations and frequencies.

Based on poker test, test whether these numbers are independent. Use α=0.05 and N=4 is 9.49.

**Solution**

In four digit number, there are five different possibilities as;

- 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)=
^{4}c_{4}x 10/10 x 9/10 x 8/10 x 7/10 = 0.504 - P(one pair)=
^{4}c_{2}x 10/10 x 1/10 x 9/10 x 8/10 = 0.432 - P(two pair)=
^{4}c_{2}x 10/10 x 1/10 x 9/10 x 1/10 = 0.027 - P(three digits of a kind)=
^{4}c_{3}x 10/10 x 1/10 x 1/10 x 9/10 = 0.036 - P(four digits of a kind)=
^{4}c_{4}x 10/10 x 1/10 x 1/10 x 1/10 = 0.001

Now the calculation table for the Chi-square statistics is

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