A Collection of Change-Point Detection Methods

Performs a series of offline and/or online change-point detection algorithms for 1) univariate mean: , ; 2) univariate polynomials: ; 3) univariate and multivariate nonparametric settings: , ; 4) high-dimensional covariances: ; 5) high-dimensional networks with and without missing values: , , ; 6) high-dimensional linear regression models: , ; 7) high-dimensional vector autoregressive models: ; 8) high-dimensional self exciting point processes: ; 9) dependent dynamic nonparametric random dot product graphs: ; 10) univariate mean against adversarial attacks: .


A collection of change-point localisation methods.

R-CMD-check Last-changedate license

Performs a series of offline and/or online change-point localisation algorithms for

  1. univariate mean
  2. univariate polynomials
  3. univariate and multivariate nonparametric settings
  4. high-dimensional covariances
  5. high-dimensional networks with and without missing values
  6. high-dimensional linear regression models
  7. high-dimensional vector autoregressive models
  8. high-dimensional self exciting point processes
  9. dependent dynamic nonparametric random dot product graphs
  10. robust univariate mean against adversarial attacks

Installation

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")
devtools::install_github("HaotianXu/changepoints")

Example

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)
y = c(rep(0, 50), rep(2, 50), rep(0, 50), rep(-2, 50)) + rnorm(200, mean = 0, sd = 1)
## estimate change points by l_0 penalization
gamma_set = c(0.01, 0.5, 1, 5, 10, 50) # possible value of tuning parameter
## perform cross-validation
DP_result = CV.search.DP.univar(y, gamma_set, delta = 5)
## estimate change points and perform local refinement
min_idx = which.min(DP_result$test_error)
cpt_DP_hat = unlist(DP_result$cpt_hat[[min_idx]])
cpt_DP_LR = local.refine.univar(cpt_DP_hat, y)

Alternatively, wild binary segmentation can also be performed:

## generate random intervals for WBS
intervals = WBS.intervals(M = 100, lower = 1, upper = 200)
## perform WBS
WBS_result = WBS.univar(y, 1, 200, intervals$Alpha, intervals$Beta, delta = 5)
WBS_result
## trim binary tree with threshold being 3
WBS_trimmed = thresholdBS(WBS_result, tau = 3)
## print the trimmed binary tree
print(WBS_trimmed$BS_tree_trimmed, "value")
## estimate change points and perform local refinement
cpt_WBS_hat = sort(WBS_trimmed$cpt_hat[,1])
cpt_BS_LR = local.refine.univar(cpt_WBS_hat, y)

wild binary segmentation with tuning parameter selected by information criteria :

WBS_CPD_result = tuneBSunivar(WBS_result, y)
WBS_CPD_LR = local.refine.univar(WBS_CPD_result$cpt, y)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("changepoints")

1.1.0 by Haotian Xu, 4 years ago


https://github.com/HaotianXu/changepoints


Browse source code at https://github.com/cran/changepoints


Authors: Haotian Xu [aut, cre] , Oscar Padilla [aut] , Daren Wang [aut] , Mengchu Li [aut] , Qin Wen [ctb]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports stats, gglasso, glmnet, ks, MASS, data.tree, Rcpp

Suggests knitr, abind, DiagrammeR, rmarkdown

Linking to Rcpp, RcppArmadillo


Suggested by ggchangepoint.


See at CRAN