JuliaDynamics / TransitionsInTimeseries.jl

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

Outline for estimating change points / tipping points #13

Closed Datseris closed 6 months ago

Datseris commented 1 year ago

Alright, so we have some measures that have been shown useful to detect transitions. We have some stuff from Early Warning Signals, where an estimator increases more and more towards the thransition, such as AR1-coefficient or Variance. We also have stuff from traditional nonlinear TSA that detect changes in dynamic behavior, such as permutation entropy.

Detecting a change function

As far as I can tell we need two different functions: one that finds significant change in an estimator, and one that finds a continuous increase of an estimator; these are two different things. So we could have: detect_change_points(x, measure, args...; kwargs...) and detect_increase(x, measure, args...; kwargs...).

Estimating significance of results

It's cool that we get the change points, how do you estimate significance? One way is with surrogate tests. E.g., for the slope / early warning signals: you collect the slopes of the surrogates. So, for each rolling window we do a surrogate test. In the surrogate test we collect a "significance" number: this is the normalized distance from the distribution: the absolute distance of the measured value of the slope at this window, minus the mean of the distribution, divided by the width of the central 5-95% quantile. If this number is less than 1 we have no significant result.

(So, this is another function on top of detect_increase or whatever)

sgen = surrogenerator(x, Method)

for i in 1:total_surrogates
   s = sgen()
   ar1_surrogate = sliding_window_apply(ar1_coeff, s, window_viewer)
   slopes = extract_slopes(ar1_surrogates
   matrix_of_slopes[i, :] .= slopes
end

significances = zeros(length(ar1_slopes_real))
for j in 1:size(matrix_of_slopes, 2)
   quantile_595 = quantile(matrix_of_slopes[:, j])
   significances[j] = abs(real_slope - mean(matrix_of_slopes[:, j])/quantile
end
JanJereczek commented 6 months ago

@Datseris, I think we can close this!