Function File: h, p, stats = runstest (x, v)

Runs test for detecting serial correlation in the vector x.

Arguments

  • x is the vector of given values.
  • v is the value to subtract from x to get runs (defaults to median(x))

Return values

  • h is true if serial correlation is detected at the 95% confidence level (two-tailed), false otherwise.
  • p is the probablity of obtaining a test statistic of the magnitude found under the null hypothesis of no serial correlation.
  • stats is the structure containing as fields the number of runs nruns; the numbers of positive and negative values of x - v, n1 and n0; and the test statistic z.

Note: the large-sample normal approximation is used to find h and p. This is accurate if n1, n0 are both greater than 10.

Reference: NIST Engineering Statistics Handbook, 1.3.5.13. Runs Test for Detecting Non-randomness, http://www.itl.nist.gov/div898/handbook/eda/section3/eda35d.htm

See also: .

Package: statistics