JuliaDynamics / RecurrenceAnalysis.jl

Recurrence Quantification Analysis in Julia
https://juliadynamics.github.io/RecurrenceAnalysis.jl/stable/
MIT License
45 stars 12 forks source link

Denominator of recurrence rate #48

Closed heliosdrm closed 5 years ago

heliosdrm commented 5 years ago

Now it is the size of the entire matrix. This is the simplest choice, and it is also coherent with the formula given in Norbert's 2007 paper, which is the most popular reference for RQA (Phys. Reports 438:237-329).

However, when a Theiler window is applied, it might also make sense to reduce the denominator, since there are less points that may be detected as recurrences. Actually the formula in the first chapter of the RQA book from 2015 has N(N-1) in the denominator, accounting for the exclusion of the N points of the LOI.

Matlab's CRP Toolbox does adjust the denominator according to the Theiler window. Other packages that I know don't, e.g. crqa or PyRQA. (I'm not counting pyunicorn, because that package just doesn't have the option of setting a Theiler window).

See also the discussion here: http://www.recurrence-plot.tk/forum/viewtopic.php?f=3&t=4641&sid=1e67d4c05d5d81297ce5888d8a305705

heliosdrm commented 5 years ago

If we make theiler=1 the default for RPs and JRPs, I'd think twice about using the "full" denominator n^2. It is the formula in some popular references (including http://www.recurrence-plot.tk/rqa.php), and the one implemented in various software packages, but with the default options even a flat time series would always have RR<1.

So, what to do?:

Datseris commented 5 years ago

Unfortunately as I said I don't have the expertise to help with this decision... Maybe @pucicu can contribute here.

pucicu commented 5 years ago

When applying the Theiler window, the denominator should be corrected by this. I think, in the chapter in the RQA book, it was not given just for didactical reasons. In deed, it would be more correct to provide there the corrected denominator.

Am 19.01.2019 um 11:15 schrieb Helios De Rosario notifications@github.com:

If we make theiler=1 the default for RPs and JRPs, I'd think twice about using the "full" denominator n^2. It is the formula in some popular references (including http://www.recurrence-plot.tk/rqa.php http://www.recurrence-plot.tk/rqa.php), and the one implemented in various software packages, but with the default options even a flat time series would always have RR<1.

So, what to do?:

Never mind, leave it as it is, simple and not that important for long time series. Always remove size of the Theiler window from the denominator. Only adjust the denominator only for RPs and JRPs (if making the default theiler different for them). In such case: Remove the size of the Theiler window. Remove only the size of the LOI (to match the formula in the RQA book). — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JuliaDynamics/RecurrenceAnalysis.jl/issues/48#issuecomment-455767283, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7WkAWL3gIa-aNILbZ0qQKZRVqu_88tks5vEvBEgaJpZM4aItnk.

heliosdrm commented 5 years ago

Thanks. What adjustement you recommend?

(a) always reduce the denominator removing the number of points covered by the Theiler window, for any matrix? (b) only adjust RPs and JRPs (leave CPRs) without denominator adjustment?

And if (b): (b.1) reduce by the full extent of the Theiler window (same as (a), but excluding CPRs)? (b.2) reduce only by N points (the extent of the LOI), as in the formula RR=sum(r)/(N(N-1)), for whatever Theiler window greater than zero?

pucicu commented 5 years ago

Haha, good point. Obviously I forgot what I wrote in the forum … But at the moment, I would say removing the Theiler window also from the denominator would make more sense.

The point is, we should test this on some prototypical ans also real world examples. But I don’t have the time to do it.

Am 18.01.2019 um 23:02 schrieb Helios De Rosario notifications@github.com:

Now it is the size of the entire matrix. This is the simplest choice, and it is also coherent with the formula given in Norbert's 2007 paper, which is the most popular reference for RQA (Phys. Reports 438:237-329).

However, when a Theiler window is applied, it might also make sense to reduce the denominator, since there are less points that may be detected as recurrences. Actually the formula in the first chapter of the RQA book from 2015 has N(N-1) in the denominator, accounting for the exclusion of the N points of the LOI.

Matlab's CRP Toolbox does adjust the denominator according to the Theiler window. Other packages that I know don't, e.g. crqa https://cran.r-project.org/package=crqa or PyRQA https://pypi.org/project/PyRQA/. (I'm not counting pyunicorn, because that package just doesn't have the option of setting a Theiler window).

See also the discussion here: http://www.recurrence-plot.tk/forum/viewtopic.php?f=3&t=4641&sid=1e67d4c05d5d81297ce5888d8a305705 http://www.recurrence-plot.tk/forum/viewtopic.php?f=3&t=4641&sid=1e67d4c05d5d81297ce5888d8a305705 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JuliaDynamics/RecurrenceAnalysis.jl/issues/48, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7WkIfKHAY0wi5g01FSxO1jVUwW-QuQks5vEkSFgaJpZM4aItnk.

pucicu commented 5 years ago

I think b.1 makes most sense.

for CRPs it would not make sense to apply a Theiler window because there isn't a LOI.

Am 19.01.2019 um 13:15 schrieb Helios De Rosario notifications@github.com:

Thanks. What adjustement you recommend?

(a) always reduce the denominator removing the number of points covered by the Theiler window, for any matrix? (b) only adjust RPs and JRPs (leave CPRs) without denominator adjustment?

And if (b): (b.1) reduce by the full extent of the Theiler window (same as (a), but excluding CPRs)? (b.2) reduce only by N points (the extent of the LOI), as in the formula RR=sum(r)/(N(N-1)), for whatever Theiler window greater than zero?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuliaDynamics/RecurrenceAnalysis.jl/issues/48#issuecomment-455775340, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7WkL3hAEVgHtwVwvdavgpxxLImMwaiks5vEwxSgaJpZM4aItnk.