rp

MATLAB scripts to create recurrence plots and to perform recurrence quantification analysis.

https://github.com/pucicu/rp

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.5%) to scientific vocabulary

Keywords

recurrence-analysis recurrence-plot recurrence-quantification time-series-analysis
Last synced: 6 months ago · JSON representation ·

Repository

MATLAB scripts to create recurrence plots and to perform recurrence quantification analysis.

Basic Info
  • Host: GitHub
  • Owner: pucicu
  • License: agpl-3.0
  • Language: MATLAB
  • Default Branch: master
  • Homepage:
  • Size: 202 KB
Statistics
  • Stars: 10
  • Watchers: 1
  • Forks: 6
  • Open Issues: 0
  • Releases: 5
Topics
recurrence-analysis recurrence-plot recurrence-quantification time-series-analysis
Created about 7 years ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation

README.md

Recurrence Plot & Quantification

Build Status commits SWH commits

Simple MATLAB functions for calculating recurrence plots and recurrence quantification.

Functions

EMBED

Creates embedding vector using time delay embedding.

Syntax

Y=EMBED(X,M,T) creates the embedding vector Y from the time series X using a time delay embedding with dimension M and delay T. The resulting embedding vector has length N-T*(M-1), where N is the length of the original time series.

Reference

  • Packard, N. H., Crutchfield, J. P., Farmer, J. D., Shaw, R. S. (1980). Geometry from a time series. Physical Review Letters 45, 712-716.

Example

matlab N = 300; % length of time series x = .9*sin((1:N)*2*pi/70); % exemplary time series y = embed(x,2,17); % embed into 2 dimensions using delay 17 plot(y(:,1),y(:,2))


RP

Calculates a recurrence plot.

Syntax

R=RP(X,E,THRESH,NORM,ALG) calculates the recurrence plot R from an embedding vector X and using the threshold E. X is a N-by-M matrix corresponding to N time points and M embedding dimensions.

[R,D]=RP(...) outputs the recurrence plot R and the underlying distance matrix D.

Optional arguments:

NORM - is a string setting the norm for distance calculation in phasespace. Can be 'euc' for euclidian norm (default) or 'max' for maximum norm.

ALG - is a string specifying the algorithm of calculating the distance matrix. Can be 'loops', 'vector' (default), or 'matlabvector'.

THRESH - is a string that specifies how the threshold epsilon will be calculated. With 'fix' (default) the RP is computed with a fixed threshold epsilon specified by the input parameter E. With 'var' the RP is computed with a fixed threshold epsilon, which corresponds to the lower 'E'-quantile (specified by E) of the distance distribution of all points in phasespace. With 'fan' the RP is computed with a variable threshold resulting in a fixed amount of nearest neighbours in phasespace, specified % by the fraction E of recurrence points

Reference

  • Marwan, N., Romano, M. C., Thiel, M., Kurths, J. (2007). Recurrence plots for the analysis of complex systems. Physics Reports, 438, 237-329.
  • Kraemer, K. H., Donner, R. V., Heitzig, J., & Marwan, N. (2018). Recurrence threshold selection for obtaining robust recurrence characteristics in different embedding dimensions. Chaos, 28, 085720.

Example

matlab N = 300; % length of time series x = .9*sin((1:N)*2*pi/70); % exemplary time series xVec = embed(x,2,17); % embed into 2 dimensions using delay 17 R = rp(xVec,.1,'fix','max'); % calculate RP using maximum norm and fixed threshold imagesc(R)


RQA

Calculates recurrence quantification analysis.

Syntax

Q=RQA(R,L,T) calculates measures of recurrence quantification analysis for recurrence plot R using minimal line length L and a Theiler window `T.

Output:

  • Y(1) = RR (recurrence rate)
  • Y(2) = DET (determinism)
  • Y(3) = <L> (mean diagonal line length)
  • Y(4) = Lmax (maximal diagonal line length)
  • Y(5) = ENTR (entropy of the diagonal line lengths)
  • Y(6) = LAM (laminarity)
  • Y(7) = TT (trapping time)
  • Y(8) = Vmax (maximal vertical line length)
  • Y(9) = RTmax (maximal white vertical line length)
  • Y(10) = T2 (recurrence time of 2nd type)
  • Y(11) = RTE (recurrence time entropy, i.e., RPDE)
  • Y(12) = Clust (clustering coefficient)
  • Y(13) = Trans (transitivity)

Reference

  • Marwan, N., Romano, M. C., Thiel, M., Kurths, J. (2007). Recurrence plots for the analysis of complex systems. Physics Reports, 438, 237-329.
  • Marwan, N., Donges, J. F., Zou, Y., Donner, R. V., Kurths, J. (2009). Complex network approach for recurrence analysis of time series. Physics Letters A, 373, 4246-4254.

Example

matlab N = 300; % length of time series x = .9*sin((1:N)*2*pi/70); % exemplary time series xVec = embed(x,2,17); R = rp(xVec,.1); Y = rqa(R);


RP_ISO

Calculates the isodirectional recurrence plot

Syntax

R=RP_ISO(X,E,W) calculates the isodirectional recurrence plot R from an embedding vector X and using the threshold E for the vector distances and threshold W for the angle to be considered as isodirectional.

R=RP_ISO(X,E,W,TAU) estimates tangential vector using time delay TAU.

Example

```matlab [t x] = ode45('lorenz',[0 100],[-6.2 -10 14]); [R1, SP, R0] = rp_iso(x(3000:5000,:),10,.2);

nexttile imagesc(R0) % regular RP axis square

nexttile imagesc(R1) % isodirectional RP axis square ```


RP_PERP

Calculates the perpendicular recurrence plot

Syntax

R=RP_PERP(X,E,W) calculates the perpendicular recurrence plot R from an embedding vector X and using the threshold E for the vector distances and threshold W for the angle to be considered as perpendicular.

R=RP_PERP(X,E,W,TAU) estimates tangential vector using time delay TAU (works only if condition in line 95 is set to 0).

Example

```matlab [t x] = ode45('lorenz',[0 100],[-6.2 -10 14]); [R1, SP, R0] = rp_perp(x(3000:5000,:),10,.25);

nexttile imagesc(R0) % regular RP axis square

nexttile imagesc(R1) % perpendicular RP axis square ```

Application

Part of this code was used in the study

  • M. H. Trauth, A. Asrat, W. Duesing, V. Foerster, K. H. Kraemer, N. Marwan, M. A. Maslin, F. Schaebitz: Classifying past climate change in the Chew Bahir basin, southern Ethiopia, using recurrence quantification analysis, Climate Dynamics, 53(5), 2557–2572 (2019). DOI:10.1007/s00382-019-04641-3

How to cite

Background

read more about recurrence plot analysis at http://www.recurrence-plot.tk/

License

(see LICENSE file)

Copyright 2016-2020, Potsdam Institute for Climate Impact Research (PIK), Institute of Geosciences, University of Potsdam, K. Hauke Kraemer, Norbert Marwan, Martin H. Trauth

Owner

  • Name: Norbert Marwan
  • Login: pucicu
  • Kind: user
  • Location: Potsdam, Germany
  • Company: Potsdam Institute for Climate Impact Research

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  Recurrence plot and recurrence quantification analysis
  implementation for MATLAB
message: 'If you use this software, please cite it as below.'
type: software
authors:
  - given-names: Norbert
    family-names: Marwan
    email: marwan@pik-potsdam.de
    affiliation: Potsdam Institute for Climate Impact Research (PIK)
    orcid: 'https://orcid.org/0000-0003-1437-7039'
  - given-names: Hauke
    family-names: Kraemer
    affiliation: Potsdam Institute for Climate Impact Research (PIK)
    orcid: 'https://orcid.org/0000-0002-9943-5391'
identifiers:
  - type: doi
    value: 10.5281/zenodo.4540728
    description: Zenodo
repository-code: 'https://github.com/pucicu/rp'
abstract: >-
  Simple MATLAB functions for calculating recurrence plots
  and recurrence quantification.
keywords:
  - time series analysis
  - recurrence plot
  - recurrence quantification
  - recurrence analysis
license: AGPL-3.0
date-released: '2022-03-03'

GitHub Events

Total
  • Watch event: 4
  • Push event: 3
Last Year
  • Watch event: 4
  • Push event: 3