teststat {robcp} | R Documentation |
Computes the test statistic for a structural break test called 'Huberized CUSUM Test'.
teststat(y, fun = "HLm", b_n, k, constant)
y |
vector or matrix with each column representing a time series (numeric). |
fun |
character string specifiyng the transformation function ψ. |
b_n |
for |
k |
numeric bound used in |
constant |
scale factor of the MAD. Default is 1.4826. |
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}{√{n} σ}|∑_{i = 1}^{k} x_i - (k / n) ∑_{i = 1}^n x_i|,
where σ is the square root of sigma2
.
In case of a matrix the test statistic follows as
max_{k = 1, ..., n}\frac{1}{n}(∑_{i = 1}^{k} X_i - \frac{k}{n} ∑_{i = 1}^{n} X_i)^T Σ^{-1} (∑_{i = 1}^{k} X_i - \frac{k}{n} ∑_{i = 1}^{n} X_i),
where X_i denotes the ith row of x and Σ^{-1} is the inverse of sigma2
.
test statistic (numeric value).
Sheila Görz
# time series with structural break at t = 20 ts <- c(rnorm(20, 0), rnorm(20, 2)) teststat(ts)