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

View source: R/wilcox_stat.R

wilcox_statR Documentation

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

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

Details

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

h = 1L:

T_n = \frac{1}{\hat{σ}} \max_{1 ≤q k ≤q n} ≤ft| \frac{1}{n^{3/2}} ∑_{i = 1}^k ∑_{j = k+1}^n (1_{\{x_i < x_j\}} - 0.5) \right|

h = 2L:

T_n = \frac{1}{\hat{σ}} \max_{1 ≤q k ≤q n} ≤ft| \frac{1}{n^{3/2}} ∑_{i = 1}^k ∑_{j = k+1}^n (x_i - x_j) \right|

\hat{σ} 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 (ρ) is computed. Then the default bandwidth follows as

b_n = \max≤ft\{≤ft\lceil n^{0.25} ≤ft( \frac{2ρ}{1 - ρ^2}\right)^{0.8} \right\rceil, 1\right\}.

Otherwise, the default for distr is FALSE and the default bandwidth is

b_n = \max≤ft\{≤ft\lceil n^{0.4} ≤ft( \frac{2ρ}{1 - ρ^2}\right)^{1/3} \right\rceil, 1\right\}.

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

Author(s)

Sheila Görz

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

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

robcp documentation built on Sept. 16, 2022, 5:05 p.m.

Related to wilcox_stat in robcp...