[SciPy-User] runstest and distribution of run lengths

josef.pktd@gmai... josef.pktd@gmai...
Fri Dec 24 16:19:21 CST 2010

Does anyone know the distribution of run lengths in a sequence of
bernoulli trial?

I thought, I can implement a runstest as a quick exercise, but I got
(kind of) stuck.

I implemented the Wald-Wolfowitz runs test (plus one and two sample
versions) according to Wikipedia
and the SAS manual. This test only looks at the total number of runs,
and the SAS manual has both the exact distribution for small samples
and the normal approximation for large sample. So, this went ok.

But the runstest in the NIST manual and in dataplot, has the entire
distribution of run lengths
They mention a book, Bradley, 1968,  that I don't have, but they don't
say what the formulas and distribution for the expected values and
standard deviation that they use are.

Does anyone have an idea or knows a more easily accessible reference?


More information about the SciPy-User mailing list