pythontime-seriescomparedtw

Assessing synchrony between time series


I would like to assess the synchrony between two time series (i.e. do they have the same evolution over time?). I am using Python. Here are examples of the time series that I have:

enter image description here

enter image description here

The first plot shows time series that have quite similar evolution (synchrony), whereas the second plot shows time series that visually do not have similar evolution.

I have considered Dynamic Time Warping to assess the similarity between the time series, but the problem is that we obtain a distance between the time series, which is difficult to interpret. What I would like is rather a standardized number (e.g. between -1 and 1 like a correlation) that would show if the series are synchronous (i.e. they increase or decrease at the same time). This way I could compare the evolution of several time series more easily even if their global distance (i.e. average value) is different as shown on the first vs. second plot. Is it possible to have such a number with Dynamic Time Warping? Or would another method be more appropriate?


Solution

  • You first probably want to define what you mean by "same evolution over time". DTW account for lags between time series and the distance. Depending on whether you normalize/scale the data, DTW for your first graph could be greater than your second graph. This would just mean that the two can be aligned better with a smaller loss while also shifting it back and forth in time. Then again DTW can also be compared because 0 distance would mean perfect alignment, while any other values would mean greater difference.

    You could also try to predict (regress) one from the other. Then again, I don't see why a simple correlation can't answer what you want to know. A Pearson correlation ould standardize the values so the distance between the two as shown in your graph shouldn't matter.

    Since you are using python, I'd like to share a tutorial I wrote a while back in comparing DTW, Pearson correaltion, and other ways to quantify synchrony for time series data: https://towardsdatascience.com/four-ways-to-quantify-synchrony-between-time-series-data-b99136c4a9c9 Hope this helps!