Description Usage Arguments Details Value References Examples
Performs Bartels rank test of randomness. The default method for testing the null hypothesis of randomness is two.sided
. By using the alternative left.sided
, the null hypothesis is tested against a trend. By using the alternative right.sided
, the null hypothesis of randomness is tested against a systematic oscillation in the observed data.
1 2 3 4 |
x |
a numeric vector of data values. |
alternative |
a character string for hypothesis testing method;
must be one of |
pvalue |
A method for asymptotic aproximation used to compute the p-value. |
Missing values are by default removed.
The RVN test statistic is
RVN=∑(R_i-R_{i+1})^2 / ∑(R_i-(n+1)/2)^2
where R_i=rank(X_i), i=1,...,n. It is known that (RVN-2)/σ is asymptotically standard normal, where σ^2=[4(n-2)(5n^2-2n-9)]/[5n(n+1)(n-1)^2].
statistic |
The value of the RVN statistic test and the theoretical mean value and variance of the RVN statistic test. |
n |
the sample size, after the remotion of consecutive duplicate values. |
p.value |
the asymptotic p-value. |
method |
a character string indicating the test performed. |
data.name |
a character string giving the name of the data. |
alternative |
a character string describing the alternative. |
Bartels, R. (1982). The Rank Version of von Neumann's Ratio Test for Randomness, Journal of the American Statistical Association, 77(377), 40-46.
Gibbons, J.D. and Chakraborti, S. (2003). Nonparametric Statistical Inference, 4th ed. (pp. 97-98). URL: http://books.google.pt/books?id=dPhtioXwI9cC&lpg=PA97&ots=ZGaQCmuEUq
1 2 3 4 5 6 7 8 9 10 11 | # Example 5.1 in Gibbons and Chakraborti (2003), p.98.
# Annual data on total number of tourists to the United States for 1970-1982.
years <- 1970:1982
tourists <- c(12362, 12739, 13057, 13955, 14123, 15698, 17523,
18610, 19842, 20310, 22500, 23080, 21916)
# See it graphically
qplot(factor(years), tourists)+ geom_point()
# Test the null against a trend
Bartels(tourists, alternative="left.sided", pvalue="beta")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.