MyNixOS website logo
Description

Detecting Changes in Autocorrelated and Fluctuating Signals.

Detect abrupt changes in time series with local fluctuations as a random walk process and autocorrelated noise as an AR(1) process. See Romano, G., Rigaill, G., Runge, V., Fearnhead, P. (2021) <doi:10.1080/01621459.2021.1909598>.

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:

# devtools::install_github("gtromano/DeCAFS")
library(DeCAFS)

Alternatively one could fork this repository, and:

# 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:

functionsdescription
DeCAFSMain function to run the DeCAFS algorithm on a sequence of observations
dataRWARGenerate a realization of a RW+AR process
estimateParametersEstimate 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 .
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:

res = DeCAFS(y)

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

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 .

res = DeCAFS(y,  beta = 2 * log(length(y)), modelParam = list(sdEta = 3, sdNu = 1, \phi = .7))
## Error: <text>: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:

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:

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 :

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:

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.

Metadata

Version

3.3.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows