The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Performs a series of offline and/or online change-point localisation algorithms for
Users must have a (C++) compiler installed on their machine that is
compatible with R (e.g. Clang). The development version of
changepoints
from GitHub
can be installed with:
## if not installed
## Install dependencies
install.packages(c("devtools","glmnet","gglasso","ks","data.tree"))
## install.packages("devtools")
::install_github("HaotianXu/changepoints") devtools
This is an example for offline univariate mean change point detection by \(l_0\) penalization:
library(changepoints)
## simulate data with true change points being 50, 100 and 150
set.seed(0)
= c(rep(0, 50), rep(2, 50), rep(0, 50), rep(-2, 50)) + rnorm(200, mean = 0, sd = 1)
y ## estimate change points by l_0 penalization
= c(0.01, 0.5, 1, 5, 10, 50) # possible value of tuning parameter
gamma_set ## perform cross-validation
= CV.search.DP.univar(y, gamma_set, delta = 5)
DP_result ## estimate change points and perform local refinement
= which.min(DP_result$test_error)
min_idx = unlist(DP_result$cpt_hat[[min_idx]])
cpt_DP_hat = local.refine.univar(cpt_DP_hat, y) cpt_DP_LR
Alternatively, wild binary segmentation
can also be
performed:
## generate random intervals for WBS
= WBS.intervals(M = 100, lower = 1, upper = 200)
intervals ## perform WBS
= WBS.univar(y, 1, 200, intervals$Alpha, intervals$Beta, delta = 5)
WBS_result
WBS_result## trim binary tree with threshold being 3
= thresholdBS(WBS_result, tau = 3)
WBS_trimmed ## print the trimmed binary tree
print(WBS_trimmed$BS_tree_trimmed, "value")
## estimate change points and perform local refinement
= sort(WBS_trimmed$cpt_hat[,1])
cpt_WBS_hat = local.refine.univar(cpt_WBS_hat, y) cpt_BS_LR
wild binary segmentation
with tuning parameter selected
by information criteria :
= tuneBSunivar(WBS_result, y)
WBS_CPD_result = local.refine.univar(WBS_CPD_result$cpt, y) WBS_CPD_LR
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.