Wald-Wolfowitz runs test for randomness tests whether the number of runs of consecutive +/- around a threshold differs from chance.
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.
One numeric series + threshold (median / mean / custom).
Observed runs + expected runs ± SD + z statistic + two-sided p.
Significant result indicates a deviation from randomness — could be autocorrelation, trend, or shifts in the median. Inspect the sequence to identify which.