Runs

From HandWiki


In any sequence of real numbers not containing exact zeros, a run is a subsequence of consecutive numbers of the same sign, immediately preceded and followed by numbers of the opposite sign, or by the beginning or end of the sequence. The number of runs in a sequence is therefore one more than the number of sign changes in the sequence.

If M positive numbers and N negative numbers appear in a random sequence with all orderings equally probable, then the expected number of runs and its variance are:

Hepa img974.gif