Given a user-specified function RS_fun
to compute the running statistics (see runMean
, runVar
, runAR
and runCorr
), a KCP permutation test (see permTest
) is first implemented to test whether
there is at least one significant change point, then through model selection most optimal number of change points is chosen.
kcpRS(data, RS_fun, RS_name, wsize = 25, nperm = 1000, Kmax = 10,
alpha = 0.05, varTest = FALSE, ncpu = 1)# S3 method for kcpRS
plot(x, ...)
# S3 method for kcpRS
print(x, kcp_details = TRUE, ...)
# S3 method for kcpRS
summary(object, ...)
Name indicated for the monitored running statistic
Dataframe of running statistics with rows corresponding to the time window and columns corresponding to the (combination of) variable(s) on which the running statistics were computed
Selected window size
Selected choice of implementation for varTest
Selected number of permutations
Selected significance level of the permutation test
Significance level of each subtest. If varTest
=0, subTest_alpha
is equal to alpha
since only the variance drop test is implemented.
If varTest
=1, subTest_alpha
=alpha
/2 since two subtests are carried out and Bonferonni correction is applied.
Optimal number of change points
Change point location(s)
P-value of the variance test
P-value of the variance drop test
A matrix comprised of the minimized variance criterion Rmin and the optimal change point location(s) for each k from 1 to Kmax
data N x v dataframe where N is the number of time points and v the number of variables
Running statistics function: Should require wsize
and wstep
as input and return a dataframe of running statistics
as output. The rows of this dataframe should correspond to the windows and the columns should correspond to the variable(s) on which the running statistics were computed.
Name of the monitored running statistic.
Window size
Number of permutations used in the permutation test
Maximum number of change points desired
Significance level of the permutation test
If set to FALSE, only the variance DROP test is implemented, and if set to TRUE, both the variance test and the variance DROP tests are implemented.
number of cpu cores to use
An object of the type produced by kcpRS
Further plotting arguments.
If TRUE, then the matrix of optimal change points solutions given k is displayed. If FALSE, then this output is suppressed.
An object of the type produced by kcpRS_workflow
Cabrieto, J., Tuerlinckx, F., Kuppens, P., Wilhelm, F., Liedlgruber, M., & Ceulemans, E. (2018). Capturing correlation changes by applying kernel change point detection on the running correlations. Information Sciences, 447, 117-139. https://doi.org/10.1016/j.ins.2018.03.010
Cabrieto, J., Adolf, J., Tuerlinckx, F., Kuppens, P., & Ceulemans, E. (2018). Detecting long-lived autodependency changes in a multivariate system via change point detection and regime switching models. Scientific Reports, 8, 15637, 1-15. https://doi.org/10.1038/s41598-018-33819-8
phase1=cbind(rnorm(50,0,1),rnorm(50,0,1)) #phase1: Means=0
phase2=cbind(rnorm(50,1,1),rnorm(50,1,1)) #phase2: Means=1
X=rbind(phase1,phase2)
res=kcpRS(data=X,RS_fun=runMean,RS_name="Mean",wsize=25,
nperm=1000,Kmax=10,alpha=.05,varTest=FALSE,ncpu=1)
summary(res)
plot(res)
Run the code above in your browser using DataLab