This function performs the Bartels test for randomness which is
based on the ranked version of von Neumann's ratio (RVN). Users can
choose whether to test against twosided, negative or positive
correlation. NA
s from the data are omitted.
1 2  bartels.test(y, alternative = c("two.sided", "positive.correlated",
"negative.correlated"))

y 
a numeric vector of data values. 
alternative 
a character string specifying the alternative hypothesis,
must be one of 
A list with the following components.
statistic 
the value of the standardized Bartels statistic. 
parameter 
RVN ratio. 
p.value 
the pvalue for the test. 
data.name 
a character string giving the names of the data. 
alternative 
a character string describing the alternative hypothesis. 
Kimihiro Noguchi, Wallace Hui, Yulia R. Gel, Joseph L. Gastwirth, Weiwen Miao
Bartels, R. (1982). The rank version of von Neumann's ratio test for randomness. Journal of the American Statistical Association 77: 40–46.
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, pvalue = 7.024e06

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.