Description Usage Arguments Value Examples
A method for detecting a single changepoint in cross-correlated data based on CPT-CC by Tveten, Eckley, Fearnhead (2020). To detect multiple changepoints, combine this function with a version of Binary Segmentation (BS), like Wild BS or Seeded BS.
1 | cpt.cc(x, Q, b = 1, min_seg_len = 2)
|
x |
An n x p data matrix where each row is an observation vector. |
Q |
An estimate of the precision matrix. See |
b |
The scaling factor for the collective anomaly penalty. Defaults to 1. |
min_seg_len |
The minimum segment length. Defaults to 2. |
An S3 class of type cptcc with the following components:
x
The input data matrix.
cpts
A data frame with two columns: variate (which variable is affected) and cpt (the location of the estimated changepoint).
1 2 3 4 5 | library(capacc)
x <- simulate_cor(n = 100, locations = 50, durations = 50, proportions = 0.2)$x
diff_x <- x[2:nrow(x), ] - x[1:(nrow(x) - 1), ]
Q <- 2 * robust_sparse_precision(diff_x, adjacency_mat(banded_neighbours(2, ncol(x)), sparse = FALSE))
res <- cpt.cc(x, Q, b = 1, min_seg_len = 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.