decafs

Fast Multiple Changepoint Detection in Time Series with with local fluctuations as a random walk process and autocorrelated noise.

https://github.com/gtromano/decafs

Science Score: 10.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
  • Academic publication links
  • Committers with academic emails
    4 of 5 committers (80.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary

Keywords

change-detection changepoint-detection time-series-analysis
Last synced: 10 months ago · JSON representation

Repository

Fast Multiple Changepoint Detection in Time Series with with local fluctuations as a random walk process and autocorrelated noise.

Basic Info
  • Host: GitHub
  • Owner: gtromano
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 3.23 MB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
change-detection changepoint-detection time-series-analysis
Created about 7 years ago · Last pushed over 3 years ago
Metadata Files
Readme

README.md

IMPORTANT: Older versions of DeCAFS have a major bug that severely affect the computational complexity of the procedure. This was fixed from version 3.3.2. Should you have an older version installed (lower than 3.3.2) please make sure you update your DeCAFS package either through CRAN or GitHub. You can check your version number at the bottom of the documentation page of DeCAFS, via help("DeCAFS").

WHAT'S NEW: In addition to the automatic model selection, we introduced a graphical iterative model selection procedure that aids the user in selecting an appropriate model for a given sequence of observations. This tuning procedure can seriously improve performances under more challenging scenarios. More details can be found by checking the documentation: help("guidedModelSelection").


DeCAFS vignette

DeCAFS is a c++ implementation for R of the DeCAFS algorithm for performing optimal multiple changepoint detection on detecting the change in mean in presence of autocorrelation or random fluctuations in the data sequence.

Installation and Requirements

Installing the package

To install the package from Github:

```r

devtools::install_github("gtromano/DeCAFS")

library(DeCAFS) ```

Alternatively one could fork this repository, and:

```r

install.packages("DeCAFS", repos = NULL, type = "source")

library(DeCAFS) ```

Requirements for the installation

The packages requires Rcpp with compiler support for the std library with the g++14 standard.

Bugs and further queries

If any bug should be spotted, or for any information regarding this package, please email the package mantainer: g dot romano at lancaster.ac.uk.

Introduction

The model

We model a combination of a radom walk process (also known as standard Brownian motion or Wiener Process) and an AR process. Let be a random vectorm then for ,

where

and

Then, DeCAFS solves the following minimization problem:

Where our , and is an indicator function..

Quick Start

This demo shows some of the features present in the DeCAFS package.

Three functions at the moment are present in the package:

|functions |description | |:------------------|:-----------------------------------------------------------------------| |DeCAFS |Main function to run the DeCAFS algorithm on a sequence of observations | |dataRWAR |Generate a realization of a RW+AR process | |estimateParameters |Estimate the parameters of our model |

At the moment only two functions for data generation and parameter estimation are present, and they all are tailored for the Random Walk. Since l2-FPOP can tackle also other Stochastic Processes, more functions are expected to be added.

A simple example

We will start generating a Random Walk. The function dataRWAR takes in:

  • the length of the sequence of observations,
  • a poisson parameter regulating the probability of seeing a jump,
  • the average magnitude of a change,
  • the and the parameters,
  • the autocorrelation parameter .

r set.seed(42) Y = dataRWAR(n = 1e3, poisParam = .01, meanGap = 15, phi = .5, sdEta = 3, sdNu = 1) y = Y[["y"]]

Running DeCAFS is fairly straightforward:

r res = DeCAFS(y)

We can plot the DeCAFS segmentation (red lines), alongside with our real segmentation (dotted blue lines).

plot of chunk plot1

Running the algorithm without estimation

Alternatively, we can also pass all the required parameters in order for it to run. In this case, since we both have an AR and RW component, we will need to pass down both , and .

r res = DeCAFS(y, beta = 2 * log(length(y)), modelParam = list(sdEta = 3, sdNu = 1, \phi = .7))

```

Error: :1:84: unexpected input

1: res = DeCAFS(y, beta = 2 * log(length(y)), modelParam = list(sdEta = 3, sdNu = 1, \

^

```

Extreme case: Random Walk

Let's say we now have the . In this case our model simply becomes a random walk plus noise:

Our Algorithm is capable of dealing with this extreme situation:

```r set.seed(44) Y = dataRWAR(n = 1e3, poisParam = .01, meanGap = 15, phi = 0, sdEta = 2, sdNu = 1) y = Y[["y"]]

res = DeCAFS(y, beta = 2 * log(length(y)), modelParam = list(sdEta = 2, sdNu = 1, phi = 0)) ```

which leads to the result:

plot of chunk plot2

Extreme case: Autoregressive model

Secondly, let's say that the In this case we end up with an Autoregressive model with changes.

In this case we need to set , and for :

```r set.seed(46) Y = dataRWAR(n = 1e3, poisParam = .01, meanGap = 10, phi = .98, sdEta = 0, sdNu = 2) y = Y[["y"]]

res = DeCAFS(y, beta = 2 * log(length(y)), modelParam = list(sdEta = 0, sdNu = 2, phi = .98)) ```

which leads to the result:

plot of chunk plot3

we see that in this case we miss one changepoint.

Contributing to this package

If you have interest to contribute to this package, please do not esitate to contact the maintainer: g dot romano at lancaster.ac.uk.

Owner

  • Name: Gaetano Romano
  • Login: gtromano
  • Kind: user
  • Location: Lancaster, UK
  • Company: Lancaster University

FOSS has been good to me. Lecturer in Statistics. Department of Mathematics and Statistics, Lancaster University, UK

GitHub Events

Total
  • Issues event: 1
Last Year
  • Issues event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 137
  • Total Committers: 5
  • Avg Commits per committer: 27.4
  • Development Distribution Score (DDS): 0.241
Past Year
  • Commits: 6
  • Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Gaetano Romano g****o@l****k 104
Gaetano Romano r****o@m****k 16
texify[bot] 3****] 15
Gaetano Romano g****o@l****k 1
Gaetano Romano r****o@m****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 2
  • Total pull requests: 8
  • Average time to close issues: 8 months
  • Average time to close pull requests: less than a minute
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • SV-97 (1)
  • Beliavsky (1)
Pull Request Authors
  • gtromano (8)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 294 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
cran.r-project.org: DeCAFS

Detecting Changes in Autocorrelated and Fluctuating Signals

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 294 Last month
Rankings
Forks count: 28.8%
Dependent packages count: 29.8%
Stargazers count: 31.7%
Average: 33.9%
Dependent repos count: 35.5%
Downloads: 43.5%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • Rcpp >= 1.0.0 imports
  • ggplot2 * imports
  • robustbase * imports