bartels.test | R Documentation |
Performes a rank version of von Neumann's ratio test as proposed by Bartels. The null hypothesis of randomness is tested against the alternative hypothesis
bartels.test(x)
x |
a vector of class "numeric" or a time series object of class "ts" |
In this function, the test is implemented as given by Bartels (1982),
where the ranks r_1, \ldots, r_n
of
the X_i, \ldots, X_n
are used for the statistic:
T = \frac{\sum_{i=1}^n (r_i - r_{i+1})^2}{\sum_{i=1}^n (r_i - \bar{r})^2}
As proposed by Bartels (1982), the p
-value is calculated
for sample sizes in the range of (10 \le n < 100)
with
the non-standard beta distribution for the range 0 \le x \le 4
with parameters:
a = b = \frac{5 n \left( n + 1\right) \left(n - 1\right)^2}
{2 \left(n - 2\right) \left(5n^2 - 2n - 9\right)} - \frac{1}{2}
For sample sizes n \ge 100
a normal approximation with
N(2, 20/(5n + 7))
is used for p
-value calculation.
A list with class "htest"
data.name |
character string that denotes the input data |
p.value |
the p-value |
statistic |
the test statistic |
alternative |
the alternative hypothesis |
method |
character string that denotes the test |
The current function is for complete observations only.
R. Bartels (1982), The Rank Version of von Neumann's Ratio Test for Randomness, Journal of the American Statistical Association 77, 40–46.
ww.test
,
wm.test
# Example from Schoenwiese (1992, p. 113)
## Number of frost days in April at Munich from 1957 to 1968
##
frost <- ts(data=c(9,12,4,3,0,4,2,1,4,2,9,7), start=1957)
bartels.test(frost)
## Example from Sachs (1997, p. 486)
x <- c(5,6,2,3,5,6,4,3,7,8,9,7,5,3,4,7,3,5,6,7,8,9)
bartels.test(x)
## Example from Bartels (1982, p. 43)
x <- c(4, 7, 16, 14, 12, 3, 9, 13, 15, 10, 6, 5, 8, 2, 1, 11, 18, 17)
bartels.test(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.