changepoints

An R Package for Change Point Localisation

https://github.com/haotianxu/changepoints

Science Score: 33.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 12 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

An R Package for Change Point Localisation

Basic Info
  • Host: GitHub
  • Owner: HaotianXu
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 8.02 MB
Statistics
  • Stars: 12
  • Watchers: 3
  • Forks: 3
  • Open Issues: 0
  • Releases: 2
Created almost 5 years ago · Last pushed almost 3 years ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# A collection of change-point localisation methods.


[![R-CMD-check](https://github.com/HaotianXu/changepoints/workflows/R-CMD-check/badge.svg)](https://github.com/HaotianXu/changepoints/actions)
[![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-green.svg)](https://github.com/HaotianXu/changepoints)
[![license](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)


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

1. univariate mean
   + [Wang, Yu and Rinaldo (2020)](https://doi.org/10.1214/20-EJS1710)
   + [Yu, Padilla, Wang and Rinaldo (2020)](https://arxiv.org/abs/2006.03283)
2. univariate polynomials
   + [Yu, Chatterjee and Xu (2021)](https://doi.org/10.1214/21-EJS1963)
3. univariate and multivariate nonparametric settings
   + [Padilla, Yu, Wang and Rinaldo (2021)](https://doi.org/10.1214/21-EJS1809)
   + [Padilla, Yu, Wang and Rinaldo (2021)](https://doi.org/10.1109/TIT.2021.3130330)
4. high-dimensional covariances
   + [Wang, Yu and Rinaldo (2021)](https://doi.org/10.3150/20-BEJ1249)
5. high-dimensional networks with and without missing values
   + [Wang, Yu and Rinaldo (2021)](https://doi.org/10.1214/20-AOS1953)
   + [Yu, Padilla, Wang and Rinaldo (2021)](https://arxiv.org/abs/2101.05477)
   + [Dubey, Xu and Yu (2021)](https://arxiv.org/abs/2110.06450)
6. high-dimensional linear regression models
   + [Rinaldo, Wang, Wen, Willett and Yu (2021)](https://proceedings.mlr.press/v130/rinaldo21a.html)
   + [Xu, Wang, Zhao, and Yu (2022)](https://arxiv.org/abs/2207.12453)
7. high-dimensional vector autoregressive models
   + [Wang, Yu, Rinaldo and Willett (2019)](https://arxiv.org/abs/1909.06359)
8. high-dimensional self exciting point processes
   + [Wang, Yu and Willett (2020)](https://arxiv.org/abs/2006.03572)
9. dependent dynamic nonparametric random dot product graphs
   + [Padilla, Yu and Priebe (2019)](https://arxiv.org/abs/1911.07494)
9. robust univariate mean against adversarial attacks
   + [Li and Yu (2021)](https://proceedings.neurips.cc/paper/2021/hash/c1e39d912d21c91dce811d6da9929ae8-Abstract.html)


## 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](https://github.com/) can be installed with:

```{r, installation, eval = FALSE}
## 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:

```{r, DP, eval = FALSE}
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:

```{r, WBS, eval = FALSE}
## 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 :

```{r, WBS.tune, eval = FALSE}
WBS_CPD_result = tuneBSunivar(WBS_result, y)
WBS_CPD_LR = local.refine.univar(WBS_CPD_result$cpt, y)
```

Owner

  • Name: Haotian Xu
  • Login: HaotianXu
  • Kind: user
  • Company: University of Warwick

GitHub Events

Total
Last Year

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 178
  • Total Committers: 2
  • Avg Commits per committer: 89.0
  • Development Distribution Score (DDS): 0.331
Past Year
  • Commits: 11
  • Committers: 1
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Haotian Xu h****2@i****m 119
Haotian Xu h****u@u****h 59
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 2 hours
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 290 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: changepoints

A Collection of Change-Point Detection Methods

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 290 Last month
Rankings
Forks count: 17.8%
Stargazers count: 17.9%
Dependent packages count: 29.8%
Average: 31.1%
Dependent repos count: 35.5%
Downloads: 54.4%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • MASS * imports
  • Rcpp * imports
  • data.tree * imports
  • gglasso * imports
  • glmnet * imports
  • ks * imports
  • stats * imports
  • DiagrammeR * suggests
  • abind * suggests
  • knitr * suggests
  • rmarkdown * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v1 composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite
  • r-lib/actions/setup-r-dependencies v1 composite