3 Phase Space Reconstruction and Continuous Auto-RQA

3.1 Phase Space Reconstruction

Here is a great video summary of the phase space reconstruction technique: https://youtu.be/6i57udsPKms

R-packages for Phase Space Reconstruction

Package casnet relies on packages fractal and rgl to reconstruct phase space. Package rgl is used for plotting and can cause problems on some windows machines. On windows You’ll need to check if you have the X Window System for interactive 3D plotting. This Linux desktop system comes installed in some way or form on most Mac and Windows systems. You can test if it is present by running rgl::open3d() in R, which will try to open an interactive plotting device.

3.1.1 Reconstruct the Lorenz attractor

Package fractal includes the 3 dimensions of the Lorenz system in the chaotic regime. Run this code rgl::plot3d(lorenz,type="l") with all three packages loaded to get an interactive 3D plot of this strange attractor.

We’ll reconstruct the attractor based on just dimension X of the system using the data from package fractal, and functions from package casnet. Don’t forget: always look at the manual pages of a function you are running.

Package fractal and package nonlinearTseries use functions with similar names, perhapp better to not load them together, or always use fractal:: and nonlinearTseries:: if you want to call the functions direclty.

Questions

  • Use lx <- lorenz[1:2048,1] to reconstruct the phase space based on lx.
    • Find an optimal embedding lag and dimension by calling crqa_parameters().
    • Use nnThres = .01. This is the proportion of remaining nearest neighbours below which we consider the number of dimensions optimal. Because this time series was generated by a simulation of a system, we can use a much lower threshold. For real data, which is much noisier, you can use 0.1 or 0.2.
    • NOTE: If you have a slow computer don’t use 2048, but use e.g. 512.

This crqa_parameters() function will call several other functions (e.g. fractal::timeLag() with method = "mutual" and nonlinearTseries::findAllNeighbours() for the false nearest neighbourhood search). Look at the manual page, you can run the crqa_parameters() function with the defaults settings, it will show a diagnostic plot. Because we have to search over a range of parameters it can take a while to get the results…

  • Based on the output:
    • Choose an embedding lag \(\tau\) (in casnet functions this is the argument emLag). Remember, this is just an optimisation choice. Sometimes there is no first minimum, or no global minimum.
    • Find an appropriate embedding dimension by looking when the false nearest neighbours drop below 1%.
  • Now you can use this information to reconstruct the phase space:
    • Embed the time series using ts_embed() (you can also use fractal::embedSeries()).
    • Inspect the object that was returned
    • Use rgl::plot3d() to plot the reconstructed space. Plot the reconstructed phase space. (You’ll need to use as.matrix() on the object created by fractal::embedSeries())

Answers

  • Use lx <- lorenz[1:2048,1] to reconstruct the phase space based on lx.
    • Find an optimal embedding lag and dimension by calling crqa_parameters().
library(rgl)
library(ggplot2)
library(fractal)
## Loading required package: splus2R
## Loading required package: ifultools
library(invctr)
library(casnet)

# The X data
lx <- lorenz[1:2048,1]

# Search for the parameters,
params <- crqa_parameters(lx)
## Registered S3 method overwritten by 'xts':
##   method     from
##   as.zoo.xts zoo