How Does the Uncertainty Principle Limit Time Series Analysis?

Why we can’t extract precise time and frequency information from a time series mutually, and how wavelet analysis can tackle this limitation

Rodrigo da Motta C. Carvalho
Towards Data Science

--

Photo by Jamie Street on Unsplash

1. Introduction

The connection between the Fourier Transform, Uncertainty Principle, and time series analysis unveils a fascinating interplay that shapes the extraction of simultaneous temporal and frequency information. To understand this relationship, it's important to first briefly understand what a Fourier Transform (FT) and the uncertainty principle are as a consequence. Then, we explore Wavelet Transform (WT) as a promising tool for this limitation, revealing specific frequency temporal occurrences with sufficient clarity.

1.1 Fourier Transform

The Fourier Transform (FT) serves as a mathematical bridge between the time and frequency domains of a function. An FT can be described as:

I’m not going into detail in this integral, but the important part is that an FT transforms the function f(x) to another function g(ω) in the frequency space. Hold that information for later, it’s going to be important. (To better understand the FT I highly recommend the video from 3Blue1Brow.)

1.2 Uncertainty Principle as a Consequence of Fourier Transform

In 1927 physicist Werner Heisenberg introduced what is probably one of the most famous concepts about quantum mechanics, the uncertainty principle [1]. The principle is basically a theorem about Fourier Transforms, when two functions are a Fourier Transform of one another, the uncertainty principle comes into play.

While we momentarily sidestep its intricate physics, consider just the essence: the product of uncertainties in position x and momentum p remains bounded. This limitation underscores the inherent boundary in measuring these quantities with infinite precision (if you’re interested check out this video).

Uncertainty Principle in the context of Physics.

This happens because position and momentum are a Fourier Transform of each other! In the case of time series analysis, the analogue of position x and momentum p is the time series in temporal t and frequency ω space, respectively.

Uncertainty Principle in the context of signal processing.

2. Conjuring Frequencies with FT in Time Series

A very important application of the Fourier Transform is in time series analysis. Consider a scenario where we need to find the inherent frequencies in the time series. For instance, think about discerning the prevalent frequencies that people re-watch a given content. Therefore, we want to transform f(t) (a time series) into g(ω), a function of the frequencies, using an FT.

2.1 Example

To exemplify let's use the Mauna Loa Weekly Atmospheric CO2 Dataset [2].

Mauna Loa Weekly Atmospheric CO2 time series. Image by the author.

Removing the linear trend to remove fake low-frequency contributions:

Time series detrended. Image by the author.

Using the Fast Fourier Transform algorithm (FFT) to calculate the FT:

Fourier Transform of the time series. Image by the author.

Whence, it’s possible to obtain the frequency that composes the series, and in this case are visible two distinct peaks, one yearly and the other half-yearly. This is a visualization of the clear seasonality of the dataset.

However, the most interesting aspects happen when there is a perturbation in the time series, which could be the impact of an event or an external variable (e.g. a near volcano eruption). To simulate this we can take the same series plus a stochastic sine addition:

Mauna Loa Weekly Atmospheric CO2 detrended time series plus a perturbation. Image by the author.

Applying the FFT to get the FT of the series:

Fourier transform of the perturbed time series. Image by the author.

Now, there is another set of peaks between 0.5 and 0.75 that is caused by the perturbation.

2.2 The limitation

At times, we want to know when the perturbation and frequency change happened, or simply the temporal placement of each frequency within the series. In our simulation o the series with and without perturbation, it's clear that most of the impact is at the beginning of the series. Yet, a visual inspection of the series combined with FT information is not enough to know where that perturbation happened. Therefore, we need to find another tool to help us.

However, the Fourier Transform (FT) comes with a trade-off: it strips away temporal information as the uncertainty principle shows, rendering us unaware of when these frequencies manifest in the series. This is where the uncertainty principle steps in. Instead of pursuing infinite accuracy in either frequency or time, we can harness the uncertainty principle, allowing us to gain insights into both quantities at a reduced resolution, all the while maintaining balance.

3. Wavelet Transform as a tool for Time and Frequency trade-off

The Wavelet Transform (WT) emerges as a resolution balancing act, which transforms our function f(t) in F(t,ω), a composition of time and frequency. I'm not going into detail about how WT works, but, to summarize, the transformation process uses a series of different wavelets (signals with known frequency and shape) to match temporal synchronization with the time series by dot products of two functions. Hence, it's possible to get a sense of the frequency and temporal occurrence but limited by less resolution in both quantities.

Example of a morlet wavelet signal (it's a complex signal, hence, there is an imaginary and real part). Image of the author.

To visualize the wavelet transform of a signal, it's common to represent the x-axis as the time scale and y-axis as the frequency scale, and the colour scale as the Power of the frequency.

For the detrended time series without perturbation,

Wavelet Transform of the Mauna Loa Weekly Atmospheric CO2 time series. Image by the author.

it’s possible to see clearly that the seasonality repeats over the years as we expected by visual inspection. But the huge peak of 1-year seasonality from the FT is now wider, so our certainty about the value decreased.

The most interesting analysis is for the simulated scenario.

Wavelet Transform of the perturbed time series. Image by the author.

The WT show that the lower frequency perturbation observed in the FT happens in the early years of the series, with significant consequences after 20–25 years. Even though the WT lose resolution both in time and frequency, the new information about the frequency occurrence is valuable and capable of answering a variety of questions.

4. Conclusion

In short, the Uncertainty Principle imposes a fundamental limitation on time series analysis, as revealed by the constraints of the Fourier Transform. While the Fourier Transform efficiently extracts frequency information from time series data, it sacrifices any knowledge of when those frequencies occur. Therefore, the Wavelet Transform is a useful tool that enables us to trade off time and frequency resolution to gain insights into the temporal occurrence of frequency components accepting a degree of uncertainty inherent to the principle.

Acknowledgements

This amazing video from Artem Kirsanov inspired me to do this article. If you do want to go further on this topic I also recommend watching the video.

Remarks

  • The Fourier Transform (FT) is super important not only for quantum mechanics and time series analysis. It's also being used at this exact moment to store this article's data in a cloud service. One of the most famous and used algorithms in history is called Fast Fourier Transform (FFT) and it’s behind basically every data compression nowadays.
  • To model the nature of subatomic particles characteristic mathematically a Fourier Transform appears naturally in quantum mechanics. Reflecting in a fundamental shift of perspective that the uncertainty principle brings to our understanding of nature. Measuring the position of a particle makes you lose information about the velocity of that same particle, and vice-versa.

--

--