huber_cusum {robcp} | R Documentation |
Performs a CUSUM test on data transformed by psi
. Depending in the choosen psi-function different types of changes can be detected.
huber_cusum(x, fun = "HLm", tol = 1e-8, b_n, k, constant)
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 ψ, 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 |
k |
numeric bound used in |
constant |
scale factor of the MAD. Default is 1.4826. |
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,…,Y_n the transformed time series. If Y_1 is one dimensional, then the teststatistik
V=\max_{k=1,…,n} \frac{1}{√{n}σ} |∑_{i=1}^k Y_i-\frac{k}{n} ∑_{i=1}^n Y_i|
is calculated, where σ^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/√{n} to improve finite sample performance.
If Y[1] is multivariate, then the test statistic
W=\max_{k=1,…,n} \frac{1}{n}(∑_{i=1}^k Y_i-\frac{k}{n} ∑_{i=1}^n Y_i)^TΣ^{-1}(∑_{i=1}^k Y_i-\frac{k}{n} ∑_{i=1}^n Y_i)
is computed, where Σ 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 (√{W}+0.58/√{n})^2.
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). |
Sheila Görz
Dü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.
sigma2
,
psi
, h_cumsum
, teststat
,
pKSdist
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)