huber_cusum: Huberized CUSUM test

View source: R/huber_cusum.R

huber_cusumR Documentation

Huberized CUSUM test

Description

Performs a CUSUM test on data transformed by psi. Depending on the chosen psi-function different types of changes can be detected.

Usage

huber_cusum(x, fun = "HLm", k, constant = 1.4826, method = "kernel",
            control = list(), fpc = TRUE, tol = 1e-8, plot = FALSE, ...)

Arguments

x

numeric vector containing a single time series or a numeric matrix containing multiple time series (column-wise).

fun

character string specifying the transformation function ψ, see details.

k

numeric bound used in psi.

constant

scale factor of the MAD. Default is 1.4826.

method

method for estimating the long run variance.

control

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

fpc

finite population correction (boolean).

tol

tolerance of the distribution function (numeric), which is used to compute p-values.

plot

should the test statistic be plotted (cf. plot.cpStat). Boolean.

...

further arguments to be passed to CUSUM.

Details

The function performs a Huberized CUSUM test. It tests the null hypothesis H_0: \boldsymbol{θ} does not change for x against the alternative of a change, where \boldsymbol{θ} is the parameter vector of interest. k is called a 'change point'. First the data is transformed by a suitable psi-function. To detect changes in location one can apply fun = "HLm", "HLg", "SLm" or "SLg" and the hypothesis pair is

H_0: μ_1 = ... = μ_n

vs.

H_1: \exists k \in \{1, ..., n-1\}: μ_k \neq μ_{k+1}

where μ_t = E(X_t) and n is the length of the time series. For changes in scale fun = "HCm" is available and for changes in the dependence respectively covariance structure fun = "HCm", "HCg", "SCm" and "SCg" are possible. The hypothesis pair is the same as in the location case, only with μ_i being replaced by Σ_i, Σ_i = Cov(X_i). Exact definitions of the psi-functions can be found on the help page of psi.

Denote by Y_1,…,Y_n the transformed time series. If Y_1 is one-dimensional, then the test statistic

V_n = \max_{k=1,…,n} \frac{1}{√{n}σ} ≤ft|∑_{i=1}^k Y_i-\frac{k}{n} ∑_{i=1}^n Y_i\right|

is calculated, where σ^2 is an estimator for the long run variance, see the help function of lrv for details. V is asymptotically Kolmogorov-Smirnov distributed. If fpc is TRUE we use a finite population correction V+0.58/√{n} to improve finite sample performance (Dürre, 2021+).
If Y_1 is multivariate, then the test statistic

W_n=\max_{k=1,…,n} \frac{1}{n}≤ft(∑_{i=1}^k Y_i-\frac{k}{n} ∑_{i=1}^n Y_i\right)' Σ^{-1}≤ft(∑_{i=1}^k Y_i-\frac{k}{n} ∑_{i=1}^n Y_i\right)

is computed, where Σ is the long run covariance, see also lrv for details. W is asymptotically distributed like the maximum of a squared Bessel bridge. We use the identity derived by Kiefer (1959) to derive p-values. Like in the one dimensional case if fpc is TRUE we use a finite sample correction (√{W}+0.58/√{n})^2.

The change point location is estimated as the time point k for which the CUSUM process takes its maximum.

Value

A list of the class "htest" containing the following components:

statistic

value of the test statistic (numeric).

p.value

p-value (numeric).

alternative

alternative hypothesis (character string).

method

name of the performed test (character string).

cp.location

index of the estimated change point location (integer).

data.name

name of the data (character string).

Author(s)

Sheila Görz

References

Dürre, A. and Fried, R. (2019). "Robust change point tests by bounded transformations", https://arxiv.org/abs/1905.06201

Dürre, A. (2021+). "Finite sample correction for cusum tests", unpublished manuscript

Kiefer, J. (1959). "K-sample analogues of the Kolmogorov-Smirnov and Cramer-V. Mises tests", The Annals of Mathematical Statistics, 420–447.

See Also

lrv, psi, psi_cumsum, CUSUM, pKSdist

Examples

set.seed(1895)

#time series with a structural break at t = 20
Z <- c(rnorm(20, 0), rnorm(20, 2))
huber_cusum(Z) 

# two time series with a structural break at t = 20
timeSeries <- matrix(c(rnorm(20, 0), rnorm(20, 2), rnorm(20, 1), rnorm(20, 3), 
                     ncol = 2))
                     
huber_cusum(timeSeries)

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

Related to huber_cusum in robcp...