Runs test for randomness

runs.test(y, plot.it = FALSE, alternative = c("two.sided",
  "positive.correlated", "negative.correlated"))

Arguments

y

A vector

plot.it

A logical. whether or not draw a plot

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

Value

A list with class "htest" containing the following components: statistic,p-value,method and data.name

Examples

y=c(1,2,2,1,1,2,1,2) runs.test(y)
#> #> Runs Test - Two sided #> #> data: y #> Standardized Runs Statistic = 0.76376, p-value = 0.445 #>
y=c("A","B","B","A","A","B","A","B") runs.test(y,alternative="p")
#> #> Runs Test - Positive Correlated #> #> data: c(1, 2, 2, 1, 1, 2, 1, 2) #> Standardized Runs Statistic = 0.76376, p-value = 0.7775 #>