Runs test for randomness of a sample set

From: AngleWyrm (no_spam_anglewyrm_at_hotmail.com)
Date: 09/18/04


Date: Sat, 18 Sep 2004 05:17:53 GMT

Given a sample set of n integers, I want to compare the number and length of
runs up and runs down against what is expected of a randomly distributed
population.

What is the formula for calculating the expected number of runs of each
length, given the number of items in the sample set?