bartels.test: Ranked Version of von Neumann's Ratio Test for Randomness

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

View source: R/bartels.test.R

Description

\insertCite

Bartels_1982;textuallawstat test for randomness that is based on the ranked version of von Neumann's ratio (RVN). Users can choose whether to test against two-sided, negative, or positive correlation. NAs from the data are omitted.

Usage

1
2
3
4
bartels.test(
  y,
  alternative = c("two.sided", "positive.correlated", "negative.correlated")
)

Arguments

y

a numeric vector of data values.

alternative

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

Value

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

statistic

the value of the standardized Bartels statistic.

parameter

RVN ratio.

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)

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

References

\insertAllCited

See Also

runs.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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
bartels.test(y)

## Sample Output
##
##        Bartels Test - Two sided
## data:  y
## Standardized Bartels Statistic -4.4929, RVN Ratio =
## 1.101, p-value = 7.024e-06

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