wildBinSeg {BayesProject} | R Documentation |
Detects multivariate changepoints in a dataset using the Wild Binary Segmentation framework of Fryzlewicz (2014).
The dataset is supplied as the first parameter.
The second parameter is a calibrated function "cusumFct(x)" which takes a multivariate data matrix x
and returns a cusum vector for it.
The threshold is supplied with parameter "threshold", parameter "m" specifies the number of random WBS intervals on each recursion level,
and "minwindow" is the minimal window size up to which the dataset is further divided recursively to find more changepoints.
wildBinSeg(x, cusumFct, threshold, m = 100, minwindow = 10, rescale.var = TRUE)
x |
A |
cusumFct |
A calibrated function which returns a cusum vector for a dataset supplied as its single input parameter. Note that rescaling of the variance should be deactivated inside "cusumFct". When using the function "bayes" as in the example below, it is advised to set the threshold to e.g. zero in order to deactivate the time-consuming (and unnecessary) threshold computation inside "bayes". |
threshold |
The testing threshold to detect the single changepoint. The threshold must be specified. |
m |
The number of random WBS intervals on each recursion level. |
minwindow |
The minimal window size up to which the dataset is further divided recursively to find more changepoints. |
rescale.var |
A boolean flag to indicate if the variance should be rescaled before detecting a changepoint. Default is TRUE. |
Fryzlewicz, P. (2014). Wild binary segmentation for multiple change-point detection. Ann Statist, 42(6):2243–2281.
library(BayesProject)
data(testdata)
bayes_cusum <- function(x) bayes(x,threshold=0,rescale.var=FALSE)$cusum
res <- wildBinSeg(testdata, cusumFct=bayes_cusum, threshold=1)
print(res)