Run Test of Randomness

Running a Test of Randomness is a non-parametric method that is used in cases when the parametric test is not in use.  In this test, two different random samples from different populations with different continuous cumulative distribution functions are obtained. Running a test for randomness is carried out in a random model in which the observations vary around a constant mean.  The observation in the random model in which the run test is carried out has a constant variance, and the observations are also probabilistically independent. The run in a run test is defined as the consecutive sequence of ones and twos.  This test checks whether or not the number of runs are the appropriate number of runs for a randomly generated series. The observations from the two independent samples are ranked in increasing order, and each value is coded as a 1 or 2, and the total number of runs is summed up and used as the test statistics.  Small values do not support suggest different populations and large values suggest identical populations (the arrangements of the values should be random).  Wald Wolfowitz run test is commonly used.

Questions Answered:

Does the X group differ from the Y group in regards to the diet treatment implemented on both groups?


Data is collected from two independent groups.

request a consultation

Discover How We Assist to Edit Your Dissertation Chapters

Aligning theoretical framework, gathering articles, synthesizing gaps, articulating a clear methodology and data plan, and writing about the theoretical and practical implications of your research are part of our comprehensive dissertation editing services.

  • Bring dissertation editing expertise to chapters 1-5 in timely manner.
  • Track all changes, then work with you to bring about scholarly writing.
  • Ongoing support to address committee feedback, reducing revisions.

If the run test is being tested for randomness, then it is assumed that the data should enter in the dataset as an ordered sample, increasing in magnitude.   This means that for carrying-out the run test for randomness, there should not be any groupings or other pre-processing.

If the run test is carried out in SPSS, then it is assumed that the variables that are being tested in the run test should be of numeric type.  This means that if the test variables are of the string type, then the variables must be coded as numbers in order to make those variables of the numeric type.

Generally, in non-parametric tests, no underlying distribution is assumed.  This holds for the run test as well, but if the number of observations is more than twenty, then it is assumed (in the run test) that the underlying distribution would be normal and would have the mean and variance that is given by the formulas as discussed above.

Null Hypothesis: The order of the ones and twos is random.

Alternative Hypothesis: The order of ones and twos is not random.

This checking is done in the following manner:

Let us consider that ‘H’ denotes the number of observations.  The ‘Ha‘ is considered to be the number that falls above the mean, and ‘Hb‘ is considered to be the number that falls below the mean. The ‘R’ is considered to be the observed number of runs.  After considering these symbols, then the probability of the observed number of runs is derived.

Formula of the mean and the variance of the observed number of the runs:

E ( R ) = H + 2 Ha Hb / H

V ( R ) = 2 Ha Hb (2 Ha Hb – H ) / H2 ( H – 1 )

The researcher should note that in the run test for the random type of model, if the value of the observations is larger than twenty, then the distribution of the observed number of runs would approximately follow normal distribution.  The value of the standard normal variate of the observed number of runs in the run test is given by the following:

Z = R – E ( R ) / Stdev ( R ).

This follows the normal distribution that has the mean as zero and the variance as 1.  This is also called the standard normal distribution that the Z variate must follow.

*For assistance with the run test of randomness click here.