Bartels: Bartels Rank Test of Randomness

Description Usage Arguments Details Value References Examples

Description

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.

Usage

1
2
3
4
Bartels(x, alternative = "two.sided", pvalue = "normal")

## Default S3 method:
Bartels(x, alternative = "two.sided", pvalue = "normal")

Arguments

x

a numeric vector of data values.

alternative

a character string for hypothesis testing method; must be one of two.sided (default), left.sided or right.sided.

pvalue

A method for asymptotic aproximation used to compute the p-value.

Details

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].

Value

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.

References

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

Examples

 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")

SciencesPo documentation built on May 29, 2017, 9:28 p.m.