| kcpRS {kcpRS} | R Documentation |
KCP on the running statistics
Description
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.
Usage
kcpRS(
data,
RS_fun,
RS_name,
wsize = 25,
nperm = 1000,
Kmax = 10,
alpha = 0.05,
varTest = FALSE,
ncpu = 1
)
## S3 method for class 'kcpRS'
plot(x, ...)
## S3 method for class 'kcpRS'
print(x, kcp_details = TRUE, ...)
## S3 method for class 'kcpRS'
summary(object, ...)
Arguments
data |
data N x v dataframe where N is the number of time points and v the number of variables |
RS_fun |
Running statistics function: Should require |
RS_name |
Name of the monitored running statistic. |
wsize |
Window size |
nperm |
Number of permutations used in the permutation test |
Kmax |
Maximum number of change points desired |
alpha |
Significance level of the permutation test |
varTest |
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. |
ncpu |
number of cpu cores to use |
x |
An object of the type produced by |
... |
Further plotting arguments. |
kcp_details |
If TRUE, then the matrix of optimal change points solutions given k is displayed. If FALSE, then this output is suppressed. |
object |
An object of the type produced by |
Value
RS_name |
Name indicated for the monitored running statistic |
RS |
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 |
wsize |
Selected window size |
varTest |
Selected choice of implementation for varTest |
nperm |
Selected number of permutations |
alpha |
Selected significance level of the permutation test |
subTest_alpha |
Significance level of each subtest. If |
BestK |
Optimal number of change points based on grid search |
changePoints |
Change point location(s) |
p_var_test |
P-value of the variance test |
p_varDrop_test |
P-value of the variance drop test |
CPs_given_K |
A matrix comprised of the minimized variance criterion Rmin and the optimal change point location(s) for each k from 1 to |
changePoints_scree_test |
Optimal number of change points based on scree test |
scree_test |
A matrix comprised of the scree values for each k from 1 to |
medianK |
Median Euclidean distance between all pairs of running statistics |
References
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. doi: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. doi:10.1038/s41598-018-33819-8
Cabrieto, J., Meers, K., Schat, E., Adolf, J. K., Kuppens, P., Tuerlinckx, F., & Ceulemans, E. (2022). kcpRS: An R package for performing kernel change point detection on the running statistics of multivariate time series. Behavior Research Methods, 54, 1092-1113. doi:10.3758/s13428-021-01603-8
Examples
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)