HodgesLehmann: Hodges Lehmann Test Statistic

View source: R/Hodges_Lehmann.R

HodgesLehmannR Documentation

Hodges Lehmann Test Statistic

Description

Computes the test statistic for the Hodges-Lehmann change point test.

Usage

HodgesLehmann(x, b_u = "nrd0", method = "kernel", control = list())
u_hat(x, b_u = "nrd0")

Arguments

x

time series (numeric or ts vector).

b_u

bandwidth for u_hat. Either a numeric value or the name of a bandwidth selection function (c.f. bw.nrd0).

method

method of long run variance estimation. 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 the time series. The Hodges-Lehmann test statistic is then computed as

\frac{√{n}}{\hat{σ}_n} \max_{1 ≤q k < n} \hat{u}_{k,n}(0) \frac{k}{n} ≤ft(1 - \frac{k}{n}\right) | med\{(x_j - x_i); 1 ≤q i ≤q k; k+1 ≤q j ≤q n\} | ,

where \hat{σ} is the estimated long run variance, computed by the square root of lrv. By default the long run variance is estimated kernel-based with the following bandwidth: first the time series x is corrected for the estimated change point and Spearman's autocorrelation to lag 1 (ρ) is computed. Then the default block length follows as

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

\hat{u}_{k,n}(0) is estimated by u_hat on data \tilde{x}, where med\{(x_j - x_i); 1 ≤q i ≤q k; k+1 ≤q j ≤q n\} was subtracted from x_{k+1}, ..., x_n. Then density with the arguments na.rm = TRUE, from = 0, to = 0, n = 1 and bw = b_u is applied to (\tilde{x}_i - \tilde{x_j})_{1 ≤q i < j ≤q n}.

Value

HodgesLehmann returns a 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".

u_hat returns a numeric value.

Author(s)

Sheila Görz

References

Dehling, H., Fried, R., and Wendler, M. "A robust method for shift detection in time series." Biometrika 107.3 (2020): 647-660.

See Also

medianDiff, lrv

Examples

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

# Hodges-Lehmann change point test statistic
HodgesLehmann(x, b_u = 0.01)

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

Related to HodgesLehmann in robcp...