Learn R Programming

robcp (version 0.3.8)

wilcox_stat: Wilcoxon-Mann-Whitney Test Statistic for Change Points

Description

Computes the test statistic for the Wilcoxon-Mann-Whitney change point test

Usage

wilcox_stat(x, h = 1L, method = "kernel", control = list())

Value

Test statistic (numeric value) with the following attributes:

cp-location

indicating at which index a change point is most likely.

teststat

test process (before taking the maximum).

lrv-estimation

long run variance estimation method.

sigma

estimated long run variance.

param

parameter used for the lrv estimation.

kFun

kernel function used for the lrv estimation.

Is an S3 object of the class "cpStat".

Arguments

x

Time series (numeric or ts vector).

h

Kernel function of the U statistic (1L or 2L, or a function with two parameters).

method

Method for estimating the long run variance. Options are "kernel", "subsampling", "bootstrap" and "none".

control

A list of control parameters for the estimation of the long run variance (cf. lrv).

Author

Sheila Görz

Details

Let n be the length of x, i.e. the number of observations.

h = 1L: $$T_n = \frac{1}{\hat{\sigma}} \max_{1 \leq k \leq n} \left| \frac{1}{n^{3/2}} \sum_{i = 1}^k \sum_{j = k+1}^n (1_{\{x_i < x_j\}} - 0.5) \right|$$

h = 2L: $$T_n = \frac{1}{\hat{\sigma}} \max_{1 \leq k \leq n} \left| \frac{1}{n^{3/2}} \sum_{i = 1}^k \sum_{j = k+1}^n (x_i - x_j) \right|$$

\(\hat{\sigma}\) is estimated by the square root of lrv. The denominator corresponds to that in the ordinary CUSUM change point test.

By default, kernel-based estimation is used.

If h = 1L, the default for distr is TRUE. If no block length is supplied, first the time series \(x\) is corrected for the estimated change point and Spearman's autocorrelation to lag 1 (\(\rho\)) is computed. Then the default bandwidth follows as $$b_n = \max\left\{\left\lceil n^{0.25} \left( \frac{2\rho}{1 - \rho^2}\right)^{0.8} \right\rceil, 1\right\}.$$

Otherwise, the default for distr is FALSE and the default bandwidth is $$b_n = \max\left\{\left\lceil n^{0.4} \left( \frac{2\rho}{1 - \rho^2}\right)^{1/3} \right\rceil, 1\right\}.$$

References

Dehling, H., et al. "Change-point detection under dependence based on two-sample U-statistics." Asymptotic laws and methods in stochastics. Springer, New York, NY, 2015. 195-220.

See Also

lrv

Examples

Run this code
# time series with a location change at t = 20
x <- c(rnorm(20, 0), rnorm(20, 2))

# Wilcoxon-Mann-Whitney change point test statistic
wilcox_stat(x, h = 1L, control = list(b_n = length(x)^(1/3)))

Run the code above in your browser using DataLab