Visualizing the Fourier Transform and Its Applications for Price Prediction
The Fourier transform (and Fourier transform visualization) is typically used to explore and process digital data, also known as discrete data, or sampled data, or a time series signal. In order to see how the Fourier transform can be applied to stock markets, we introduce some basic ideas about how the transform works.
This article contains some level of mathematical detail. You can skip some of these sections, and keep reading to find out about price prediction applications of this equation.
To jump directly to a section, click the table of contents:
Download the Full Fourier Transform Slide Deck (Additional Examples)
Send download link to:
What is a Fourier Transform?
Above is an image showing a classic example of how the Fourier transform works.
- the red wave represents the incoming signal
- the purple waves show how the Fourier transform performs a fit to the data
- the blue wave represents the transformed data output
So, the Fourier transform equation fits sines and cosines to the data to make an exact fit to the original data points.
In this simple Fourier transform example, the incoming red signal is unknown. However, after Fourier analysis, we get a clear description of the content of the data. In this visualization, the transformed blue result shows three periodic spikes, which clearly stand out from the random Gaussian noise under them.
The Fourier Transform Equation and Its Components
For those interested in the mathematical formula of the Fourier transform, there it is.
Let’s see what happens when we set N to 10.
The Fourier transform equation creates a 10 by 10 matrix from the original data.
Fourier Transform as a Matrix
The Fourier transform equation also creates a set of angles, which are also 10 by 10, to be inserted into the Matrix. Each element in each column is distinct with its own angle measurement. Then, each matrix column is summed, giving 10 transformed values.
Each output value describes the energy of the “x” values in terms of frequency.
Fourier Transform Example: Vibration of a Car Engine
In the top graph the signal looks complicated and random.
The bottom graph shows the Fourier analysis. We might expect to see the RPM of the engine idle, but in fact we see two distinct frequencies, one spike at 15 Hz (900 RPM) and a second large spike at 30 Hz (1800 RPM). The second spike occurs because two pairs of pistons are moving out of phase with each other, and, because two revolutions of the crankshaft are needed for all 4 cylinders to fire.
Overall, the bottom frequency response plot shows the separate energy components versus frequency.
White Noise and Brownian Noise in a Fourier Transform
White noise AKA Gaussian noise is random noise — it is common in real life physical systems. Random noise is generally not predictable. The Fourier transform of white noise also has a “random” appearance in the spectrum.
Another type of noise is Brownian noise AKA random walk noise — it is common in real life physical systems. Brownian noise might have useful predictive information buried inside of it. Such predictability depends very much on the skill and experience of the person doing the analysis.
Fourier analysis is relevant and applicable to stock price fluctuation.
Fourier Transform and Price Prediction
Online, many academics say that the Fourier transform has no value for prediction of stock prices, etc. However, in the aerospace and defense industry, analysts work with frequency-domain tools every day. In aerospace, some in-house methods are well beyond the textbooks and white paper literature. In academia, many signal processing methods are out of date, such as the discussion of using spline techniques on low-pass digital filters.
The frequency response spectrum separates the different energy components so that analysts can see the content of the time series. The Fourier transform is used extensively in mathematics, engineering, and the physical sciences.
Volatility, Noise, and Prediction Skill
We can stack Fourier transforms to visualize changes in the spectrum over time. This technique is used to analyze dynamic systems. It is known as a waterfall plot. In the following sequence of images, we show the time-changing spectrum behavior for IBM stock prices. Notice that the spectral appearance does not resemble the spectrum for random noise behavior (shown earlier). Over time, the stock price energy is moving, heaving, and shifting. Something quantitative is happening.
We may also choose to focus on time-changing behaviors for one selected frequency, as shown by the red line in the figure. The following images show four selected frequencies for IBM. In each case, we observe “quasi-periodic” waves, an indication of organized behavior, not random behavior.
The Fourier transform robustly helps to clear up unwanted noise, and to extract what we want to see — patterns and non-random behavior.
Once we have identified something quantitative, we can predict something accurately. Typically, the next step is to apply DSP (Digital Signal Processing) which is related to Fourier methods.
- The Fourier Transform uses sines and cosines to fit the data perfectly.
- The spectrum shows the energy of the data as a function of frequency.
- For best results, take a data sample long enough to be representative.
- Gaussian (random) white noise usually cannot be predicted directly.
- Brownian noise typically has a slope of minus 1. Information might be buried in it.
- A waterfall plot shows the dynamic changes of the system over time.
- DSP helps extract the information from the data that we want to see.
- Statistical methods cannot do that.