CUSUM {HDCD} | R Documentation |
CUSUM transformation of a matrix
Description
R wrapper for C function computing the CUSUM transformation of a matrix over an interval . For compatibility with C indexing, the user should subtract
from both
and
when supplying the arguments to the function. If start and stop are not supplied, the CUSUM is computed over the full data, so
. In this case,
CUSUM
returns the same result as cusum.transform
in the package InspectChangepoint
(Wang and Samworth 2020).
Usage
CUSUM(X, start = NULL, stop = NULL)
Arguments
X |
Matrix of observations, where each row contains a time series |
start |
Starting point of interval over which the CUSUM should be computed, subtracted by one |
stop |
Ending point of interval over which the CUSUM should be computed, subtracted by one |
Value
A matrix of CUSUM values. The -th element corresponds to the CUSUM transformation of the
-th row of
, computed over the interval
and evaluated at position
, i.e.
,
where
,
and
.
References
Wang T, Samworth R (2020). InspectChangepoint: High-Dimensional Changepoint Estimation via Sparse Projection. R package version 1.1, https://CRAN.R-project.org/package=InspectChangepoint.
Examples
n = 10
p = 10
set.seed(101)
X = matrix(rnorm(n*p), ncol = n, nrow=p)
# CUSUM over the full data (s,e] = (0,n]
X_cusum = CUSUM(X)
# CUSUM over (s,e] = (3,9]:
s = 3
e = 9
X_cusum = CUSUM(X, start = s-1, stop = e-1)