Learn R Programming

robcp (version 0.2.5)

teststat: Test statistic for the Huberized CUSUM Test

Description

Computes the test statistic for a structural break test called 'Huberized CUSUM Test'.

Usage

teststat(y, fun = "HLm", b_n, k, constant)

Arguments

y

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

fun

character string specifiyng the transformation function \(\psi\).

b_n

for sigma2.

k

numeric bound used in psi.

constant

scale factor of the MAD. Default is 1.4826.

Value

test statistic (numeric value).

Details

y is transformed by fun. Let x be the resulting vector or matrix and n be the length of a time series.

In case of a vector the test statistic can be written as $$max_{k = 1, ..., n}\frac{1}{\sqrt{n} \sigma}|\sum_{i = 1}^{k} x_i - (k / n) \sum_{i = 1}^n x_i|,$$ where \(\sigma\) is the square root of sigma2.

In case of a matrix the test statistic follows as $$max_{k = 1, ..., n}\frac{1}{n}(\sum_{i = 1}^{k} X_i - \frac{k}{n} \sum_{i = 1}^{n} X_i)^T \Sigma^{-1} (\sum_{i = 1}^{k} X_i - \frac{k}{n} \sum_{i = 1}^{n} X_i),$$ where \(X_i\) denotes the ith row of x and \(\Sigma^{-1}\) is the inverse of sigma2.

See Also

h_cumsum, psi

Examples

Run this code
# NOT RUN {
# time series with structural break at t = 20
ts <- c(rnorm(20, 0), rnorm(20, 2))

teststat(ts)
# }

Run the code above in your browser using DataLab