Main Content

Run test for randomness

returns
a test decision for the null hypothesis that the values in the data
vector `h`

= runstest(`x`

)`x`

come in random order, against the alternative
that they do not. The test is based on the number of runs of consecutive
values above or below the mean of `x`

. The result `h`

is `1`

if
the test rejects the null hypothesis at the 5% significance level,
or `0`

otherwise.

`h = runstest(___,`

returns
a test decision using additional options specified by one or more
name-value pair arguments. For example, you can change the significance
level of the test, specify the algorithm used to calculate the `Name,Value`

)*p*-value,
or conduct a one-sided test.

[1] Gibbons, Jean Dickinson, and
Subhabrata Chakraborti. *Nonparametric Statistical Inference.* 5th
ed. Boca Raton: CRC Press, 2011.