CUSUM: CUSUM Test Statistic

View source: R/CUSUM.R

CUSUMR Documentation

CUSUM Test Statistic

Description

Computes the test statistic for the CUSUM change point test.

Usage

CUSUM(x, method = "kernel", control = list(), inverse = "Cholesky", ...)

Arguments

x

vector or matrix with each column representing a time series (numeric).

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

inverse

character string specifying the method of inversion. Options are "Cholesky" for inverting over modifChol and "generalized" for using ginv from the MASS package.

...

further arguments passed to the inverse-computing functions.

Details

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}{√{n} σ}≤ft|∑_{i = 1}^{k} x_i - (k / n) ∑_{i = 1}^n x_i\right|,

where σ 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 (ρ) is computed. Then the default bandwidth follows as

b_n = \max≤ft\{≤ft\lceil n^{0.45} ≤ft( \frac{2ρ}{1 - ρ^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}≤ft(∑_{i = 1}^{k} X_i - \frac{k}{n} ∑_{i = 1}^{n} X_i\right)^T Σ^{-1} ≤ft(∑_{i = 1}^{k} X_i - \frac{k}{n} ∑_{i = 1}^{n} X_i\right),

where X_i denotes the i-th row of x and Σ^{-1} is the inverse of lrv.

Value

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

Author(s)

Sheila Görz

See Also

psi_cumsum, psi

Examples

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

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

Related to CUSUM in robcp...