JuliaDynamics / TransitionsInTimeseries.jl

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

Add KS-statistic example #61

Closed Datseris closed 8 months ago

Datseris commented 9 months ago

Closes #4, #29.

This PR contributes a new example that does what the above issues requested. It also allows the possibility of using nothing as indicators, in which case the indicator analysis is completely skipped and the change metric is estimated directly from input timeseries.

Still todo:

Datseris commented 8 months ago

@JanJereczek I need your help. I do not understand why my newest test fails. See my @testset "nothing indicator" begin in the full_analysis.jl test file. When I compute the significant flags, every single timepoint gets significance. I don't understand why. Only one timepoint, that where c > 1 should be significant. at all other timepoints the change metric value should not be significant.

This is the plot of the change metric:

image

I don't understand what's going on.

Datseris commented 8 months ago

tests fail here because our p-value counting code is wrong. It become wrong when we changed it to the current code, which admittedly is incredibly complex and overengineered. The performance of pvalues is miniscule so we should simplify the code so that bugs are transparent and easy to find.

In any case the PR here is fine.

I also added some plotting code that I will finish in a different PR. I'll go ahead and merge this in and we can work on the individual issues later.