Learn R Programming

robcp (version 0.2.5)

huber_cusum: Huberized CUSUM test

Description

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

Usage

huber_cusum(x, fun = "HLm", tol = 1e-8, b_n, k, constant)

Arguments

x

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

fun

character string specifiyng the transformation function \(\psi\), see details.

tol

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

b_n

bandwidth, which is used to estimate the long run variance, see the help page of sigma2 for details.

k

numeric bound used in psi.

constant

scale factor of the MAD. Default is 1.4826.

Value

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

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

data.name

name of the data (character string).

Details

The function performs a Huberized CUSUM test. First the data is transformed by a suitable psi-function. To detect changes in location one can apply fun = "HLm", "HLg", "VLm" or "VLg", for changes in scale fun = "HCm" is avaliable and for changes in the dependence respectively covariance structure fun = "HCm", "HCg", "VCm" and "VCg" are possible. The actual definitions of the psi-functions can be found in the help page of psi. Denote \(Y_1,\ldots,Y_n\) the transformed time series. If \(Y_1\) is one dimensional, then the teststatistik $$V=\max_{k=1,\ldots,n} \frac{1}{\sqrt{n}\sigma} |\sum_{i=1}^k Y_i-\frac{k}{n} \sum_{i=1}^n Y_i| $$ is calculated, where \(\sigma^2\) is an estimator for the long run variance, see the help function of sigma2 for details. \(V\) is asymptoticaly Kolmogorov-Smirnov distributed. We use a finite sample correction \(V+0.58/\sqrt{n}\) to improve finite sample performance. If \(Y[1]\) is multivariate, then the test statistic $$W=\max_{k=1,\ldots,n} \frac{1}{n}(\sum_{i=1}^k Y_i-\frac{k}{n} \sum_{i=1}^n Y_i)^T\Sigma^{-1}(\sum_{i=1}^k Y_i-\frac{k}{n} \sum_{i=1}^n Y_i) $$ is computed, where \(\Sigma\) is the long run covariance, see also sigma2 for details. \(W\) is asymptotically distributed like the maximum of a squared Bessel bridge. We use the identity derived in Kiefer to derive p-values. Like in the one dimensional case we use a finite sample correction \((\sqrt{W}+0.58/\sqrt{n})^2\).

References

D<U+00FC>rre, A. and Fried, R. (2019). "Robust change point tests by bounded transformations", https://arxiv.org/abs/1905.06201

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

See Also

sigma2, psi, h_cumsum, teststat, pKSdist

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab