infer_runs_test: Test for Random Order

Description Usage Arguments Value Deprecated Function References Examples

View source: R/ifr-runs-test.R

Description

runtest tests whether the observations of x are serially independent i.e. whether they occur in a random order, by counting how many runs there are above and below a threshold. By default, the median is used as the threshold. A small number of runs indicates positive serial correlation; a large number indicates negative serial correlation.

Usage

1
2
3
4
5
6
7
8
infer_runs_test(
  data,
  x,
  drop = FALSE,
  split = FALSE,
  mean = FALSE,
  threshold = NA
)

Arguments

data

a data.frame or tibble

x

numeric; column in data

drop

logical; if TRUE, values equal to the threshold will be dropped from x

split

logical; if TRUE, data will be recoded in binary format

mean

logical; if TRUE, mean will be used as threshold

threshold

threshold to be used for counting runs, specify 0 if data is coded as a binary.

Value

infer_runs_test returns an object of class "infer_runs_test". An object of class "infer_runs_test" is a list containing the following components:

n

number of observations

threshold

within group sum of squares

n_below

number below the threshold

n_above

number above the threshold

mean

expected number of runs

var

variance of the number of runs

n_runs

number of runs

z

z statistic

p

p-value of z

Deprecated Function

runs_test() has been deprecated. Instead use infer_runs_test().

References

Sheskin, D. J. 2007. Handbook of Parametric and Nonparametric Statistical Procedures, 4th edition. : Chapman & Hall/CRC.

Edgington, E. S. 1961. Probability table for number of runs of signs of first differences in ordered series. Journal of the American Statistical Association 56: 156–159.

Madansky, A. 1988. Prescriptions for Working Statisticians. New York: Springer.

Swed, F. S., and C. Eisenhart. 1943. Tables for testing randomness of grouping in a sequence of alternatives. Annals of Mathematical Statistics 14: 66–87.

Examples

1
2
3
4
5
6
7
8
9

inferr documentation built on May 29, 2021, 1:07 a.m.