The runs test calculator applies the Wald-Wolfowitz test to a sequence of two kinds of values and tells you whether the order looks random, from the expected number of runs, the z-score and the p-value.
How the calculation works
- Enter the number of items of each kind.
- Enter the number of runs you counted.
- The calculator gives the expected runs, their standard deviation, z, the p-value and the possible range.
Example
A sequence has 12 heads and 10 tails, in 8 runs. The expected number is 2 × 12 × 10 / 22 + 1 = 11.909, with a standard deviation of 2.269. So z = (8 − 11.909) / 2.269 = -1.723 and the two-sided p-value is 0.0849: there is no clear evidence against randomness at the 5 % level, although the runs are a bit fewer than expected.
Why it matters
The calculator helps statistics students, quality controllers who check for drifts in a process, traders who test a series of gains and losses, and researchers who verify that a coin or a generator behaves randomly.
Good to know
The test detects clustering and alternation but not every kind of non-randomness. For measurements, split at the median so that the groups are balanced, and ignore values equal to the median. With fewer than about 10 items in a group, use exact tables rather than the normal approximation. A significant result tells you that the order is unusual, not why. Combine it with a plot of the data in order. A trend or a cycle in a process shows up as too few runs, while an overcorrecting operator causes too many.
Related tools
The sign test calculator compares paired values, the Wilcoxon signed-rank calculator uses their size, the coin flip calculator gives probabilities of sequences and the binomial calculator computes the chance of a given count.