Say I have a sequence of length $n$ of $k$ different elements, s.t. $n > k, k > 2$. I want to show this sequence is random, based on the number of runs. I found this paper by AM Mood which explains how to find the expected values and variances of the number of runs of each type, but I'm unsure how to show that a sequence is random from this data. I'm new to hypothesis testing and statistics in general, so any help would be appreciated.
1 Answers
Showing that a sequence is random is rather more than you can do: in practice you can check for consistency with randomness.
This was a favourite topic for statisticians who liked the algebra of discrete probability in the middle of the twentieth century, but it seems a little like a backwater now. Depending on your $n$ and $k$, getting a P-value out of published formulas or software may be a little challenging. But there is now an easy alternative, which is just to simulate, namely to compare the number of runs you have with the distribution of the number of runs in a large number of random shuffles of the data.
A jointly written paper with some tutorial flavour is accessible at
Smeeton, N. and Cox, N.J. 2003. Do-it-yourself shuffling & the number of runs under randomness. Stata Journal 3(3): 270--277. http://www.stata-journal.com/sjpdf.html?articlenum=st0044
and if you use Stata
. search smeeton, author
will find downloadable commands.

- 48,377
- 8
- 110
- 156