runs.test: Runs Test for Randomness

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Performs the runs test for randomness \insertCiteMendenhall_Reinmuth_1982lawstat. Users can choose whether to plot the correlation graph or not, and whether to test against two-sided, negative, or positive correlation. NAs from the data are omitted.

Usage

1
2
3
4
5
runs.test(
  y,
  plot.it = FALSE,
  alternative = c("two.sided", "positive.correlated", "negative.correlated")
)

Arguments

y

a numeric vector of data values.

plot.it

logical. If TRUE, then the graph will be plotted. If FALSE (default), then it is not plotted.

alternative

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

Details

On the graph, observations that are less than the sample median are represented by red letters "A", and observations that are greater or equal to the sample median are represented by blue letters "B".

Value

A list of class "htest" with the following components:

statistic

the value of the standardized runs statistic.

p.value

the p-value for the test.

data.name

a character string giving the names of the data.

alternative

a character string describing the alternative hypothesis.

Author(s)

Wallace Hui, Yulia R. Gel, Joseph L. Gastwirth, Weiwen Miao

References

\insertAllCited

See Also

bartels.test

Examples

1
2
3
4
5
6
##Simulate 100 observations from an autoregressive model 
## of the first order (AR(1))
y = arima.sim(n = 100, list(ar = c(0.5)))

##Test y for randomness
runs.test(y)

gel-research-group/lawstat documentation built on Dec. 20, 2021, 9:50 a.m.