Computes the test statistic for the CUSUM change point test.
CUSUM(x, method = "kernel", control = list(), inverse = "Cholesky", ...)
Test statistic (numeric value) with the following attributes:
indicating at which index a change point is most likely.
test process (before taking the maximum).
long run variance estimation method.
estimated long run variance.
parameter used for the lrv estimation.
kernel function used for the lrv estimation.
Is an S3 object of the class "cpStat".
vector or matrix with each column representing a time series (numeric).
method of long run variance estimation. Options are "kernel"
, "subsampling"
, "bootstrap"
and "none"
.
a list of control parameters for the estimation of the long run variance (cf. lrv
).
character string specifying the method of inversion. Options are "Cholesky" for inverting over modifChol
, "svd" for singular value decomposition and "generalized" for using ginv
from the MASS
package.
further arguments passed to the inverse-computing functions.
Sheila Görz
Let n be the length of the time series \(x = (x_1, ..., x_n)\).
In case of a univariate time series the test statistic can be written as $$\max_{k = 1, ..., n}\frac{1}{\sqrt{n} \sigma}\left|\sum_{i = 1}^{k} x_i - (k / n) \sum_{i = 1}^n x_i\right|,$$ where \(\sigma\) is the square root of lrv
.
Default method is "kernel"
and the default kernel function is "TH"
. If no bandwidth value is supplied, first the time series \(x\) is corrected for the estimated change point and Spearman's autocorrelation to lag 1 (\(\rho\)) is computed. Then the default bandwidth follows as
$$b_n = \max\left\{\left\lceil n^{0.45} \left( \frac{2\rho}{1 - \rho^2} \right)^{0.4} \right\rceil, 1 \right\}.$$
In case of a multivariate time series the test statistic follows as
$$\max_{k = 1, ..., n}\frac{1}{n}\left(\sum_{i = 1}^{k} X_i - \frac{k}{n} \sum_{i = 1}^{n} X_i\right)^T \Sigma^{-1} \left(\sum_{i = 1}^{k} X_i - \frac{k}{n} \sum_{i = 1}^{n} X_i\right),$$ where \(X_i\) denotes the i-th row of x and \(\Sigma^{-1}\) is the inverse of lrv
.
psi_cumsum
,
psi
# time series with a location change at t = 20
ts <- c(rnorm(20, 0), rnorm(20, 2))
# Huberized CUSUM change point test statistic
CUSUM(psi(ts))
Run the code above in your browser using DataLab