Skip to content

Quantification & Analysis functions

A recurrencematrix can be analyzed in several ways to yield information about the dynamics of the timeseries. All these various quantities and functions listed in this section are also listed in the wikipedia page for Recurrence quantification analysis. We also suggest the review articles listed in our documentation strings, namely:

  1. N. Marwan et al., "Recurrence plots for the analysis of complex systems", Phys. Reports 438(5-6), 237-329 (2007).
  2. N. Marwan & C.L. Webber, "Mathematical and computational foundations of recurrence quantifications", in: Webber, C.L. & N. Marwan (eds.), Recurrence Quantification Analysis. Theory and Best Practices, Springer, pp. 3-43 (2015).

The following functions all accept a recurrence matrix, see the previous page.

#RecurrenceAnalysis.recurrencerateFunction.

recurrencerate(x; theiler=0)

Calculate the recurrence rate (RR) of a recurrence matrix, ruling out the points within the Theiler window.

#RecurrenceAnalysis.determinismFunction.

determinism(x; lmin=2, theiler=0)

Calculate the determinism (DET) of a recurrence matrix, ruling out the points within the Theiler window and diagonals shorter than a minimum value.

#RecurrenceAnalysis.avgdiagFunction.

avgdiag(x; lmin=2, theiler=0)

Calculate the average diagonal length (L) in a recurrence matrix, ruling out the points within the Theiler window and diagonals shorter than a minimum value.

#RecurrenceAnalysis.maxdiagFunction.

maxdiag(x; theiler=0)

Calculate the longest diagonal (Lmax) in a recurrence matrix, ruling out the points within the Theiler window.

#RecurrenceAnalysis.divergenceFunction.

divergence(x; lmin=2, theiler=0)

Calculate the divergence of a recurrence matrix (actually the inverse of maxdiag.

#RecurrenceAnalysis.trendFunction.

trend(x; theiler=0, border=10)

Calculate the trend of recurrences in recurrence matrix towards its edges, ruling out the points within the Theiler window and in the outermost diagonals.

#RecurrenceAnalysis.laminarityFunction.

laminarity(x; lmin=2, theiler=0)

Calculate the laminarity (LAM) of a recurrence matrix, ruling out vertical lines shorter than a minimum value.

#RecurrenceAnalysis.trappingtimeFunction.

trappingtime(x; lmin=2, theiler=0)

Calculate the trapping time (TT) of a recurrence matrix, ruling out vertical lines shorter than a minimum value.

#RecurrenceAnalysis.maxvertFunction.

maxvert(x; theiler=0)

Calculate the longest vertical line (Vmax) of a recurrence matrix.

#RecurrenceAnalysis.entropyFunction.

entropy(x; lmin=2, theiler=0)

Calculate the entropy of diagonal lengths (ENT) of a recurrence matrix, ruling out the points within the Theiler window and diagonals shorter than a minimum value.

This function is not exported and should be accessed like RecurrenceAnalysis.entropy.


Since most of the above functions can be fined tuned with keyword arguments, here is a table summarizing them that could be of use:

ArgumentDefaultFunctionsDescription
scale1recurrencematrix
crossrecurrencematrix
jointrecurrencematrix
Function or fixed number to scale the threshold or radius that is used to identify recurrences. Use maximum if the threshold is to be taken as a fraction of the maximum distance, mean if it is a fraction of the mean distance, etc., and 1 (identity scale, applied by default) to keep the threshold without scaling.
theiler0recurrencerate
determinism
avgdiag
maxdiag
divergence
entropy
trend
laminarity
trappingtime
maxvert
'Theiler' window: number of diagonals around the LOI excluded from the analysis.
lmin2determinism
avgdiag
maxdiag
divergence
entropy
laminarity
trappingtime
maxvert
Minimum length of the recurrent structures (diagonal or vertical) considered in the analysis.
border10trendNumber of diagonals excluded from the analysis near the border of the matrix.

All-in-one Bundle

In case you need all of the aforementioned functions and you don't want to write 10 lines of code to compute them all (since they are so many) we also got an all-in-one function that computes all of them and returns a dictionary of the result!

#RecurrenceAnalysis.rqaFunction.

rqa(x; kwargs...)

Calculate RQA parameters of a recurrence matrix. See the functions recurrencerate, determinism, avgdiag, maxdiag, divergence, entropy, trend, laminarity, trappingtime and maxvert for the definition of the different parameters and the default values of the arguments.

The keyword arguments theilerdiag, lmindiag may be used to declare specific values that override the values of theiler and lmin in the calculation of parameters related to diagonal structures. Likewise, theilervert and lminvert can be used for the calculation of parameters related to vertical structures.

The returned value is a dictionary with the following keys:

  • "RR": recurrence rate (see recurrencerate)
  • "DET": determinsm (see determinism)
  • "L": average length of diagonal structures (see avgdiag)
  • "Lmax": maximum length of diagonal structures (see maxdiag)
  • "DIV": divergence (see divergence)
  • "ENT": entropy of diagonal structures (see entropy)
  • "TND": trend of recurrences (see trend)
  • "LAM": laminarity (see laminarity)
  • "TT": trapping time (see trappingtime)
  • "Vmax": maximum length of vertical structures (seemaxvert`)

The keyword argument onlydiagonal (false by default) can be set to true in order to restrict the analysis to the recurrence rate and the parameters related to diagonal structures ("RR", "DET", "L", "Lmax", "DIV" and "ENT").


See also the @windowed macro for a windowed version of the above!