runs.test

0th

Percentile

Runs Test

Computes the runs test for randomness of the dichotomous (binary) data series x.

Keywords
ts
Usage
runs.test(x, alternative = c("two.sided", "less", "greater"))
Arguments
x
a dichotomous factor.
alternative
indicates the alternative hypothesis and must be one of "two.sided" (default), "less", or "greater". You can specify just the initial letter.
Details

This test searches for randomness in the observed data series x by examining the frequency of runs. A "run" is defined as a series of similar responses.

Note, that by using the alternative "less" the null of randomness is tested against some kind of "under-mixing" ("trend"). By using the alternative "greater" the null of randomness is tested against some kind of "over-mixing" ("mean-reversion"). Missing values are not allowed.

Value

  • A list with class "htest" containing the following components:
  • statisticthe value of the test statistic.
  • p.valuethe p-value of the test.
  • methoda character string indicating what type of test was performed.
  • data.namea character string giving the name of the data.
  • alternativea character string describing the alternative hypothesis.

References

S. Siegel (1956): Nonparametric Statistics for the Behavioural Sciences, McGraw-Hill, New York. S. Siegel and N. J. Castellan (1988): Nonparametric Statistics for the Behavioural Sciences, 2nd edn, McGraw-Hill, New York.

Aliases
  • runs.test
Examples
x <- factor(sign(rnorm(100)))  # randomness
runs.test(x)

x <- factor(rep(c(-1,1),50))  # over-mixing
runs.test(x)
Documentation reproduced from package tseries, version 0.9-11, License: GPL (see file COPYING)

Community examples

Looks like there are no examples yet.