summaxcusum {BayesProject} | R Documentation |
Cpp implementation of sum-cusum and max-cusum for single changepoint detection.
Description
Detects one multivariate changepoint in a dataset using the sum-cusum or max-cusum technique. Solely required is the dataset as first parameter. The testing threshold ("threshold") is chosen automatically if missing. The parameter "sum_cusum" (default TRUE) indicates if sum-cusum or max-cusum is used.
Usage
summaxcusum(x, threshold, sum_cusum = TRUE, rescale.var = TRUE)
Arguments
x |
A |
threshold |
The testing threshold to detect the single changepoint. If missing, parameter will be calibrated automatically. |
sum_cusum |
A boolean flag to indicate if sum cusum (sum_cusum=T) or max cusum (sum_cusum=F) is used. Default is TRUE. |
rescale.var |
A boolean flag to indicate if the variance should be rescaled before detecting a changepoint. Default is TRUE. |
References
Hahn, G., Fearnhead, P., Eckley, I.A. (2020). Fast computation of a projection direction for multivariate changepoint detection. Stat Comput.
Examples
library(BayesProject)
data(testdata)
resSumCusum <- summaxcusum(testdata,sum_cusum=TRUE)
print(resSumCusum$cpt)
resMaxCusum <- summaxcusum(testdata,sum_cusum=FALSE)
print(resMaxCusum$cpt)