Recurrence quantification analysis is a widely used method for characterizing patterns in time series. This article presents a comprehensive survey for conducting a wide range of recurrence-based analyses to quantify the dynamical structure of single and multivariate time series and capture coupling properties underlying leader-follower relationships. The basics of recurrence quantification analysis (RQA) and all its variants are formally introduced step-by-step from the simplest auto-recurrence to the most advanced multivariate case. Importantly, we show how such RQA methods can be deployed under a single computational framework in R using a substantially renewed version of our crqa 2.0 package. This package includes implementations of several recent advances in recurrence-based analysis, among them applications to multivariate data and improved entropy calculations for categorical data. We show concrete applications of our package to example data, together with a detailed description of its functions and some guidelines on their usage.
In the current article, we present the updated 2.0 version of the R package crqa to perform many variants of recurrence-based analyses (Coco and Dale 2014), including some very recent developments for the treatment of multivariate and categorical data. Recurrence-based techniques allow the quantification of temporal structure and generalized autocorrelation properties of individual time series (Zbilut and Webber 1992; Webber and Zbilut 1994), the quantification of bivariate relationships, and coupling between two time series (Zbilut et al. 1998; Marwan and Kurths 2002), as well as the quantification of multidimensional dynamics of multivariate time series (Wallot et al. 2016b; Wallot and Mønster 2018). Recurrence-based techniques originate from the description and analysis of dynamical systems (Marwan and Kurths 2002; Marwan et al. 2007) and have been widely applied to data from physics (Zolotova and Ponyavin 2006; Donner and Thiel 2007; Alex et al. 2015; Hilarov 2017; Ambro\.zkiewicz et al. 2019), physiology (Mestivier et al. 2001; Thomasson et al. 2001; Marwan et al. 2002; Langbein et al. 2004; Mønster et al. 2016; Timothy et al. 2017), and psychology (Shockley et al. 2003; Wijnants et al. 2012; Abney et al. 2014; Coco et al. 2016, 2018; Wallot et al. 2019; Pagnotta et al. 2020), to name a few fields.
The real success of recurrence-based analyses has revolved around their power of capturing the dynamics of complex and non-stationary time series data and of time series exhibiting qualitatively different patterns along with their temporal evolution (Marwan et al. 2007). This is because recurrence-based analyses are model-free techniques that make few assumptions and hence are well suited for the analysis of complex systems. Moreover, recurrence-based analyses are versatile and can be applied to interval-scale data as well as nominal data, continuously sampled data, and inter-event data alike (Zbilut et al. 1998; Dale et al. 2011).
The new version of the crqa package features the integration of major developments in recurrence analysis, such as its extension to multidimensional data, as well as a key simplification of its design and a marked improvement of the underlying computational procedures. It includes useful new functions, including a tool for mining the parameter settings for continuous data and piece-wise computation of recurrence plots to mitigate the computational cost of long time series.
The remainder of this article is divided into two broad sections. In the first section, we provide a concise introduction to the core concepts of recurrence analysis from the simplest case of auto-recurrence of a unidimensional time series to the most complex case of multidimensional cross-recurrence, which is now integrated into the new version of the crqa package. In the second section, we showcase example applications of the different analysis methods using empirical data, hence providing a hands-on tutorial for how to use the different functions of the package.
In section 2.1, we briefly introduce the framework of recurrence quantification analysis (RQA hereafter) with the simplest case of a unidimensional time series. Then, in section 2.2, we discuss how RQA can be applied to two different unidimensional times series. Finally, in sections 2.3 and 2.4 we explain how RQA methods can be extended to multidimensional data.
The concept of recurrence is at the heart of all recurrence-based analyses (Trulla et al. 1996; Marwan and Kurths 2002), which mostly apply to time series or sequenced data (but see (Wallot and Leonardi 2018b)). As we will see, recurrences are often defined in terms of phase space coordinates, not directly in terms of the values of a single time series, but the concept is easily demonstrated using this case—a single time series or sequence—as a starting point. Loosely speaking, a recurrence is the repetition of a value in a sequence of data points. More precisely, recurrence in a time series \(x\), with \(n\) data points \(x_1,x_2,\ldots,x_n\) is defined as:
\[R_{ij} = \left\{ \begin{array}{lr} 1 & : x_i = x_j\\ 0 & : x_i \neq x_j \end{array} \right. \quad i,j = 1,2, \ldots n\]
The above equation defines the elements \(R_{ij}\) of the recurrence matrix \(\mathbf{R}\) in terms of identical repetitions. Such a definition is useful for a nominal sequence, where there are categorical elements that are either identical or not, and so no meaningful ‘distance’ norm among categories can be defined (see section 3.3.1 for an application to text data). In order to define recurrences for continuous data, we need to establish a threshold parameter (or radius parameter) \(\varepsilon\), which provides the width of a tolerance band in the chosen distance norm within which similar but not identical values in a time series are counted as recurrent:
\[\label{eq:Rij_1d} R_{ij} = \left\{ \begin{array}{lr} 1 & : \vert x_i - x_j \vert \leq \varepsilon \\ 0 & : \vert x_i - x_j \vert > \varepsilon \end{array} \right. \quad i,j = 1,2, \ldots n \tag{1}\]
Setting a threshold is necessary in most cases for empirical data because such data feature intrinsic fluctuations as well as measurement error (Marwan et al. 2007). Using recurrences as defined above, we can convert any unidimensional time series \(x\) into a recurrence plot (RP), which is a two-dimensional portrait of its dynamics expressed through its recurrence characteristics.
Figure 1 shows some examples of time series of various complexity (i.e., a sinusoidal, a chaotic attractor, and white noise) and their associated RPs, given some value for the threshold parameter \(\varepsilon\).