**Example:**

Suppose that 12 people have been polled to find out if they use a certain product. If all the 12 people are of the same sex, one would suspect the randomness of the sample. We shall designate the persons as male and female as they enter into the sample, in the order in which they are questioned. A typical sequence of the experiment may be as follows:

__M ____M__ F F F __M __ F F __M ____M__ __M__ __M__

The above is a series containing 5 runs.

**Calculation:**

Let n1 be the number of symbols associated with the category that occurs the least and n2 be the number that belongs to the other category. Then the sample size is n= n1 + n2.

For the n=12 symbols in our series , there are 5 runs.

If the number of runs is smaller or larger than what we would expect by chance, the null hypothesis that the sample is drawn randomly should be rejected.

If the sample is having too few, say 2 runs, or if it has too many, say 11 or 12, it is unlikely to be drawn in a random manner. Too few suggest a trend and two many suggest a periodicity.

The run test for randomness is based on the random variable V, the total number of runs, that occur in the complete sequence in our experiment.

In Table A- 18 ( page 736 of Probability and statistics for Engineers and Scientists by Ronald E, Walpole and Raymond H Myers), values of P ( V?v* when H0 is true) are given for v* = 2,3,.....20 runs, and values of n1 and n2 less than are equal to 10.

In the series considered above, there are 5 Fs and 7 Ms. Hence with n1= 5 and n2=7, and v=5, we note from Table A.18, for a two tailed test that the P value is

P= 2p(V? 5 when H0 is true)= 0.394

In the table, it is seen like this- For row value (5,7); under column value 5, probability is 0.197. Multiplied by 2, it is 0.394.

This value is > 0.05.

We accept H0 . That is, the value v=5 is reasonable at the 0.05 level of significance when H0 is true, and therefore we have insufficient evidence to reject the hypothesis of randomness in our sample.

We reject Ho when:

We compare our calculated critical value with the critical value shown in the table, and our value is more than the value in the table

We compare our accepted or assigned probability (level of significance, ?, usually 0.05 or 0.01) with the probability value shown in the standard statistical table, and our value is less than the value in the table.

Suppose the number of runs is large, for example v=11 and n1 = 5 and n2=7, then the P value in a two tailed test is (row value (5,7), column value 10, probability is 0.992)

P= 2P (V?11 when H0 is true )

= 2 [1-P(V?10) when H0 is true]

= 2(1-0.992)=0.016

0.016<0.05

This leads us to reject the hypothesis that the sample values occurred at random.

**Also please see**

**Part 1**