# Runs test

The runs test is a non-parametric test for randomness in a sequence of values such as a time series. Non-randomness may include such effects as autocorrelation, trend and periodicity. The module requires one column of data, which are internally converted to 0 (x is negative or 0) or 1 (x>0).

The test is based on a dichotomy between two values (0 or 1). It counts the number of runs (groups of consecutive equal values) and compares this to a theoretical value. The runs test can therefore be used directly for sequences of binary data. There are also options for “runs about the mean” (the mean value subtracted from the data prior to testing), or “runs up and down” (the differences from one value to the next taken before testing).

The two-tailed *p* value based on a *Z* statistic is not accurate for *n*<20. A Monte Carlo procedure is therefore also included, based on 10,000 random replicates.

For mathematical details, see the Past manual.