# 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.

Subscribe to the Insight Blog. Get notified when blogs, like this one, come out. You can unsubscribe anytime.

## 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.

## Conclusion

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.

Summary:

• 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.

## Additional Resources: Fourier Analysis in Modeling and Prediction

### Fourier Videos

At the University of Washington Brunton Lab, nonlinear modeling projects are funded by government organizations including DARPA, NSF, and DOE.  Thirty nine videos are available on Fourier analysis. Select the desired video from the upper right-hand corner.  The Brunton playlist has 17 different topics in nonlinear modeling. Lastly, here is the full online book “Data-Driven Science and Engineering” by Steve Brunton, et al.

### The Fourier Matrix: A High-Tech Math Invention

The below illustration visually shows a Fourier transform matrix. Indeed, it is the matrix that performs the actual transformation. The matrix contains weighting factors, ranging from -1 to +1.
• Red is the minimum value (minus 1)
• White is no weight (value of 0)
• And blue is the maximum value (plus 1)
The colors reveal that the weighting factors have undulations and symmetries. Remarkably these weighting factors transform 2-D time series data values into 3-D energy packets!
The founder of Insight Inc became acquainted with these so called “frequency domain methods” during his experience on US nuclear submarines under secret clearance.

### Chaos or Symmetry?

Only one thing in the ocean environment is random. And that is the white noise background of the ocean itself. However, everything else has a frequency-specific signature and energy. A kind of ever prevailing beauty and symmetry.
Certainly, entities with such geometry can be detected, tracked, and identified using SONAR or signal processing techniques. For example, the founder of Insight Inc used spectral analysis and advanced modeling methods to study detailed data sets. He did this within the realm of aerospace engineering under secret clearance.
To sum up, signal processing identifies patterns by making a clean organized signal.