Patterns › Time series

Runs test (Wald-Wolfowitz randomness)

Wald-Wolfowitz runs test for randomness tests whether the number of runs of consecutive +/- around a threshold differs from chance.

What is Runs test (Wald-Wolfowitz randomness)?

Convert the series to a sequence of + (above threshold) and − (below threshold), count the number of 'runs' (maximal same-sign stretches), and compare to the expectation under independence. Too few runs ⇒ positive autocorrelation (clumping); too many ⇒ negative autocorrelation (alternation).

Distribution-free — no normality required. Standard sanity check on residuals from a regression or time-series model: if residuals are independent the runs test should not reject.

When should I use Runs test (Wald-Wolfowitz randomness)?

  • Independence check on residuals from a fitted model.
  • Quality-control: is a sequence of pass/fail outcomes random or showing trends?

What data does it need?

One numeric series + threshold (median / mean / custom).

What does it report?

Observed runs + expected runs ± SD + z statistic + two-sided p.

How do I interpret the result?

Significant result indicates a deviation from randomness — could be autocorrelation, trend, or shifts in the median. Inspect the sequence to identify which.

See also

References

  • Wald & Wolfowitz (1940). On a test whether two samples are from the same population. AoMS 11(2).