Learn R Programming

A collection of change-point localisation methods.

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)

Copy Link

Version

Install

install.packages('changepoints')

Monthly Downloads

220

Version

1.1.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Haotian Xu

Last Published

September 4th, 2022

Functions in changepoints (1.1.0)

CV.search.DP.VAR1

Grid search based on cross-validation of dynamic programming for VAR change points detection via \(l_0\) penalty.
CV.search.DP.poly

Grid search for dynamic programming to select the tuning parameter through Cross-Validation.
CI.regression

Confidence interval construction of change points for regression settings with change points.
BS.univar

Standard binary segmentation for univariate mean change points detection.
BS.cov

Binary Segmentation for covariance change points detection through Operator Norm.
BD_U

Backward detection with a robust bootstrap change point test using U-statistics for univariate mean change.
CV.search.DP.LR.regression

Grid search based on Cross-Validation of all tuning parameters (gamma, lambda and zeta) for regression.
CV.search.DP.regression

Grid search based on cross-validation of dynamic programming for regression change points localisation with \(l_0\) penalisation.
BS.uni.nonpar

Standard binary segmentation for univariate nonparametric change points detection.
ARC

Adversarially robust univariate mean change point detection.
DP.univar

Dynamic programming for univariate mean change points detection through \(l_0\) penalty.
DP.SEPP

Dynamic programming for SEPP change points detection through \(l_0\) penalty.
DP.poly

Dynamic programming algorithm for univariate polynomials change points detection.
DP.regression

Dynamic programming algorithm for regression change points localisation with \(l_0\) penalisation.
CV.search.DP.univar

Grid search for dynamic programming to select the tuning parameter through Cross-Validation.
LRV.regression

Long-run variance estimation for regression settings with change points.
Hausdorff.dist

Bidirectional Hausdorff distance.
CV.search.DPDU.regression

Grid search based on cross-validation of dynamic programming for regression change points localisation with \(l_0\) penalisation.
DP.VAR1

Dynamic programming for VAR1 change points detection through \(l_0\) penalty.
DPDU.regression

Dynamic programming with dynamic update algorithm for regression change points localisation with \(l_0\) penalisation.
aARC

Automatic adversarially robust univariate mean change point detection.
calibrate.online.network.missing

Calibrate step for online change point detection for network data with missing values.
WBS.uni.rob

Robust wild binary segmentation for univariate mean change points detection.
WBS.uni.nonpar

Wild binary segmentation for univariate nonparametric change points detection.
local.refine.VAR1

Local refinement for VAR1 change points detection.
local.refine.DPDU.regression

Local refinement for DPDU regression change points localisation.
WBS.multi.nonpar

Wild binary segmentation for multivariate nonparametric change points detection.
WBS.intervals

Generate random intervals for WBS.
gen.missing

Function to generate a matrix with values 0 or 1, where 0 indicating the entry is missing
gen.piece.poly

Generate univariate data from piecewise polynomials of degree at most r.
WBS.network

Wild binary segmentation for network change points detection.
WBS.nonpar.RDPG

Wild binary segmentation for dependent dynamic random dot product graph models.
local.refine.CV.VAR1

Local refinement for VAR1 change points detection.
huber_mean

Element-wise adaptive Huber mean estimator.
lambda.network.missing

Function to compute the default thresholding parameter for leading singular value in the soft-impute algorithm.
WBS.univar

Wild binary segmentation for univariate mean change points detection.
gen.piece.poly.noiseless

Mean function of piecewise polynomials.
WBSIP.cov

Wild binary segmentation for covariance change points detection through Independent Projection.
local.refine.poly

Local refinement for univariate polynomials change point detection.
local.refine.network

Local refinement for network change points detection.
softImpute.network.missing

Estimate graphon matrix by soft-impute for independent adjacency matrices with missing values.
online.univar

Online change point detection with controlled false alarm rate or average run length.
online.network.missing

Online change point detection for network data with missing values.
tuneBSmultinonpar

A function to compute change points based on the multivariate nonparametic method with tuning parameter selected by FDR control.
tuneBSunivar

Univariate mean change points detection based on standard or wild binary segmentation with tuning parameter selected by sSIC.
trim_interval

Interval trimming based on initial change point localisation.
simu.RDPG

Simulate a dot product graph (without change point).
online.univar.multi

Online change point detection with potentially multiple change points.
thresholdBS

Thresholding a BS object with threshold value tau.
online.network

Online change point detection for network data.
changepoints

changepoints-package: A Collections of Change-Point Detection Methods
tuneBSnonparRDPG

Change points detection for dependent dynamic random dot product graph models.
lowertri2mat

Transform a vector containing lower diagonal entries into a symmetric matrix of dimension p.
gen.cov.mat

Generate population covariance matrix with dimension p.
tuneBSuninonpar

Wild binary segmentation for univariate nonparametric change points detection with tuning parameter selection.
simu.SEPP

Simulate a (stable) SEPP model (without change point).
simu.SBM

Simulate a Stochastic Block Model (without change point).
local.refine.univar

Local refinement of an initial estimator for univariate mean change points detection.
local.refine.regression

Local refinement for regression change points localisation.
simu.VAR1

Simulate from a VAR1 model (without change point).
simu.change.regression

Simulate a sparse regression model with change points in coefficients.