# Wald–Wolfowitz runs test

The Wald–Wolfowitz runs test (or simply runs test), named after Abraham Wald and Jacob Wolfowitz, is a non-parametric statistical test that checks a randomness hypothesis for a two-valued data sequence. More precisely, it can be used to test the hypothesis that the elements of the sequence are mutually independent.

## Definition

A run of a sequence is a maximal non-empty segment of the sequence consisting of adjacent equal elements. For example, the 22-element-long sequence "++++−−−+++−−++++++−−−−" consists of 6 runs, 3 of which consist of "+" and the others of "−". The run test is based on the null hypothesis that each element in the sequence is independently drawn from the same distribution.

Under the null hypothesis, the number of runs in a sequence of N elements is a random variable whose conditional distribution given the observation of N+ positive values and N negative values (N = N+ + N) is approximately normal, with:

• mean • variance These parameters do not assume that the positive and negative elements have equal probabilities of occurring, but only assume that the elements are independent and identically distributed. If the number of runs is significantly higher or lower than expected, the hypothesis of statistical independence of the elements may be rejected.

## Applications

Runs tests can be used to test:

1. the randomness of a distribution, by taking the data in the given order and marking with + the data greater than the median, and with – the data less than the median (numbers equalling the median are omitted.)
2. whether a function fits well to a data set, by marking the data exceeding the function value with + and the other data with −. For this use, the runs test, which takes into account the signs but not the distances, is complementary to the chi square test, which takes into account the distances but not the signs.

## Related tests

The Kolmogorov–Smirnov test has been shown to be more powerful than the Wald-Wolfowitz test for detecting differences between distributions that differ solely in their location. However, the reverse is true if the distributions differ in variance and have at the most only a small difference in location.

The Wald-Wolfowitz runs test has been extended for use with several samples.

## References

1. N is the number of elements, not the number of runs.
2. N+ is the number of elements with positive values, not the number of positive runs
3. Runs Test for Detecting Non-randomness
4. Sample 33092: Wald-Wolfowitz (or Runs) test for randomness
5. Magel RC, Wibowo SH (1997) Comparing the powers of the Wald-Wolfowitz and Kolmogorov-Smirnov tests. Biometrical Journal 39(6): 665-667.
6. Barton DE, David FN (1957) Multiple runs. Biometrika 44(1-2):168-178.
7. Sprent P, Smeeton NC (2007) Applied Nonparametric Statistical Methods, pp. 217-219. Boca Raton: Chapman & Hall/ CRC.
8. Alhakim A, Hooper W (2008) A non-parametric test for several independent samples. Journal of Nonparametric Statistics 20(3): 253-261.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8768529,"math_prob":0.97233427,"size":3026,"snap":"2022-05-2022-21","text_gpt3_token_len":709,"char_repetition_ratio":0.12541363,"word_repetition_ratio":0.008230452,"special_character_ratio":0.2419035,"punctuation_ratio":0.09836066,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9840824,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-26T07:05:04Z\",\"WARC-Record-ID\":\"<urn:uuid:e85be2ff-de11-4c71-bf58-0e411b50f921>\",\"Content-Length\":\"10511\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:da59f8cb-8747-454c-a700-664bd5f3c67c>\",\"WARC-Concurrent-To\":\"<urn:uuid:caa7246b-7227-4c22-b950-085d7f51edd2>\",\"WARC-IP-Address\":\"209.94.90.1\",\"WARC-Target-URI\":\"https://gateway.ipfs.io/ipfs/QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/Wald%E2%80%93Wolfowitz_runs_test.html\",\"WARC-Payload-Digest\":\"sha1:LWRCSFD2AEAKVNPE6UKKQBATJTI7KZJW\",\"WARC-Block-Digest\":\"sha1:SUNA7VL3WMUQVU3OQKOBRE22J5W7QBKD\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662604495.84_warc_CC-MAIN-20220526065603-20220526095603-00142.warc.gz\"}"}