Recurrence Quantification Analysis
Recurrence Quantification Analysis
An analysis method for dynamical systems.
Flip Phillips
Skidmore College Vision Laboratories
© 2015-9
Skidmore College Vision Laboratories
© 2015-9
Acknowledgements
Acknowledgements
• I was introduced to RQA for eye tracking, somewhat skeptically, by Jeff Pelz of RIT.
• The original package was developed with my student Dave ‘CORM’ Jacobs for work on eye tracking trajectory analysis.
• The package was further developed for use by Alison Ord as part of the 2019 Wolfram Summer School. Code contributions from Paul Abbott.
• The original package was developed with my student Dave ‘CORM’ Jacobs for work on eye tracking trajectory analysis.
• The package was further developed for use by Alison Ord as part of the 2019 Wolfram Summer School. Code contributions from Paul Abbott.
Notes
Notes
Much can be learned from —
Webber Jr, C. L., & Zbilut, J. P. (2005). Recurrence quantification analysis of nonlinear dynamical systems. Tutorials in contemporary nonlinear methods for the behavioral sciences, 94, 26-94. https://www.nsf.gov/pubs/2005/nsf05057/nmbs/chap2.pdf
This chapter is from a collection on the subject of nonlinear methods, Tutorials in contemporary nonlinear methods for the behavioral sciences, written for the NFS and edited by Michael Riley and Guy Van Orden. https://nsf.gov/pubs/2005/nsf05057/nmbs/nmbs.pdf
Guy passed away from pancreatic cancer a few years after I met him. He was a super nice, encouraging, and helpful person. If you use this package and feel the need to pay-it-forward somehow, consider dropping a few bucks to a cancer charity or the NSF or NIH.
Examples
Examples
Preliminaries
Preliminaries
Load the package:
In[]:=
<<RQA`
If you’d like to see what is there —
In[]:=
?RQA`*
Out[]=
Data
Data
We use a Henon attractor as example data.
In[]:=
α=1.4;β=0.3;nMax=2000;settle=40;
In[]:=
henonxy=Drop[RecurrenceTable[{x[n+1]1-α+y[n],y[n+1]βx[n],x[0]==0.0,y[0]==0.0},{x,y},{n,1,nMax+settle},DependentVariables{x,y}],settle];
2
x[n]
In[]:=
ListPlot[henonxy]
Out[]=
Time Series
Time Series
The RQA package uses the Wolfram Language as its primary data structure. This is primarily since the analysis our lab has used has been in the time domain. Obviously, RQA is not limited to temporal dynamics, so this is a bit of a compromise that creates a class of parametric function in one variable. Future versions might (well, do in our local stuff) support other parameterizations, multidimensional in nature:
In[]:=
hts=TimeSeries[TemporalData[henonxy,{1,Automatic,1},ValueDimensions2]]
Out[]=
TimeSeries
Let’s use an interesting, 200-wide, window:
In[]:=
tStart=1001;w=200;
In[]:=
hw=TimeSeriesWindow[hts,{tStart,tStart+w-1}]
Out[]=
TimeSeries
Make a 1D, x-only version looking at just the changes of the x-variable:
In[]:=
hx=TimeSeries[TemporalData[hw["Values"][[All,1]],{tStart,tStart+w-1,1}]]
Out[]=
TimeSeries
In[]:=
ListLinePlot[hx,AxesNone,Frame->True,AspectRatio.4]
Out[]=
Embedding
Embedding
Embed our data into 3 dimensions with a lag/τ of 1.0:
In[]:=
hxe3=RQAEmbed[hx,3,1.0]
Out[]=
TimeSeries
This shows how the x-coordinate jumps back and forth over time but within the pattern of the attractor:
In[]:=
ParametricPlot3D[hxe3[t],{t,1001,1198}]
Out[]=
Distance Map
Distance Map
You can use any distance function you’d like. By default, SquaredEuclideanDistance is used.
The above is a plot of the distances over time. The x and y axes are increasing t from the lower left.
Recurrence Map
Recurrence Map
Here' s a true recurrence map with a distance threshold of 0.03:
We can make a nice distance-coded version by multiplying the recurrence map by the distance map. Here, we rescale the distance map to get everything normalized on {0,1} do the right thing, rendering-wise —
Not as visually interesting for this rather sparse map, but, it gets cooler as things get bigger.
RQA Measurements
RQA Measurements
Recurrence
Recurrence
Determinism
Determinism
Dmax (aka Vmax in earlier work)
Dmax (aka Vmax in earlier work)
Entropy
Entropy
Trend
Trend
Note that, right now, I believe the trend calculations are wrong.
Laminarity
Laminarity
Trapping time
Trapping time