JuliaDynamics / TransitionsInTimeseries.jl

Transition Indicators / Early Warning Signals / Regime Shifts / Change Point Detection
MIT License
18 stars 5 forks source link

New IndicatorsChangesConfig: PELTSegmentation #52

Open Datseris opened 10 months ago

Datseris commented 10 months ago

Alright, with the v0.1 interface out we have a clear way of adding new analysis pipelines for estimating transitions in timeseries. We have the supertype IndicatorsChangesConfig. New subtypes need to extend the estimate_indicator_changes function.

I propose here a new subtype called something like PELTSegmentation that utilizes the existing https://github.com/STOR-i/Changepoints.jl package.

The idea is as follows:

  1. The user provides an indicator, and a sliding window configuration. This produces indicator timeseries. Alternatively, the user may give identity as an indicator in which case this first step is skipped.
  2. The PELT algorithm from ChangePoints.jl is applied directly to the indicator timeseries. The user provides the parameters of the PELT algorithm as arguments to the new type PELTSegmentation.
  3. The results type will then contain the indicator timeseries as well as the time flags that the PELT algorithm identified as change points.

Testing for significance: the approach of surrogates we have currently does not work out of the box, because in the end we will have discrete time points where there are transitions. That's how PELT works: it doesn't give you a change metric (the PELT algorithm integrates the changes of distributions into the resulting optimized change points). However, we can still use surrogates! We can perform the same 1-2-3 step analysis for 1000 surrogates. For each, we get the potential change points. We then have the user specify a significance window: a time window around the change points of the original timeseries. We can count how many surrogates are within this window and if there are many then the transition could happen by chance.