My aim is to transform a one-dimensional time-series into a two-dimensional phase space. Since the time-series is one-dimensional, the phase space will be a pseudo (lag) phase space.
One theoretical approach to transform a time-series into pseudo phase space is as follows:
- The original list of data is the full-length time-series x(t).
- A subseries of data is the "lagged" version of the original time-series, starting with the second value of the time-series (instead of with its first one, as the original time-series) x(t+1).
Consequently, the subseries will always have one value less in its list. For a 3D phase space, a second subseries would have two values less in its list. This is where my code related problem comes in, since matplotlib does not allow me to plot a two-dimensional plane when the length of two lists is not equal.
Here is my current code:
import numpy as np
import matplotlib.pyplot as plt
# Example time-series
Data = [924, -5, 24, 1, 0, 242, -5, 42, 5, 1, -9, 50, 3, 432, 0, -5, 4, 1, 2, 3]
# Embedding (time-series to phase space)
x_list = Data[:-1]
y_list = Data[1:]
# Plot
plt.plot(x_list, y_list, c="blue", linewidth=0.5)
plt.show()
This code uses the whole length of the time-series except the last value in the list by x_list = Data[:-1]
for the x-axis. For the y-axis, the code uses the whole time-series except the very first item in the list by Data[1:]
.
While this code works, its result is not a real embedding of a time-series into its two-dimensional phase space, since x_list = Data[:-1]
does not include the last value of the time-series.
What would be a proper way for coding and plotting the phase space of subseries that increasingly diminish in length compared to the original time-series data?