Discovering the Frequencies in Financial Markets
Discovering the Frequencies in Financial Markets

December 2, 2021

Share this article:

Wavelet analysis stems from the 19th century when Joseph Fourier studied the heat equation. From his work, a foundation was set for Fourier transformations (FT). However, FT requires conditions such as stationarity of the data set and it only gives frequency information of a time series instead of the time information simultaneously. Consequently, wavelet analysis was introduced and developed to overcome the shortcomings of FT on financial data.

Properties of wavelets

There are two different wavelet functions, namely the father wavelet \phi and the mother wavelet \psi. The following conditions must hold for the father wavelet function:

(1)   \begin{equation*}\int_{-\infty}^{\infty}\phi(x)dx = 1 \:\: \text{and} \:\: \int_{-\infty}^{\infty} | \phi(x)| ^2dx < \infty.\end{equation*}

And for the mother wavelet:

(2)   \begin{equation*}\int_{-\infty}^{\infty}\psi(x)dx = 0 \:\: \text{and} \:\: \int_{-\infty}^{\infty} | \psi(x)| ^2dx < \infty.\end{equation*}

At last, we have an orthogonality condition:

(3)   \begin{equation*}\int_{-\infty}^{\infty}\psi(x)\phi(x)dx = 0.\end{equation*}

Furthermore, we can choose our wavelet to behave according to a specific shape. There are discrete (like the Haar wavelet), symmetric (the Mexican hat wavelet), near symmetric (such as the symmlet) and asymmetric wavelets (like daublets).

The corresponding father and mother functions of the Haar filter are defined by:

(4)   \begin{equation*} \phi(x) = \begin{cases} 1 & \text{if $0 \leq x < 1$} \\ 0 & \text{otherwise} \end{cases} \;\;\; \text{and} \;\;\; \psi(x) = \begin{cases} 1 & \text{if $0 \leq x < \frac{1}{2}$} \\ -1 & \text{if $\frac{1}{2} \leq x < 1$} \\ 0 & \text{otherwise} \end{cases} \end{equation*}

To give an idea how these wavelets look like, the father and mother wavelets of the Haar wavelet are plotted in the figure below.

Wavelet analysis

The discrete wavelet transform (DWT) multiresolution analysis (MRA) allows the decomposition of a time series into its constituent multiresolution (frequency) components. Given a time series y_t, a certain number of observations N, its wavelet multiresolution representation is given by:

(5)   \begin{equation*}y_t = \sum_k s_{J, k} \phi_{J, k}(t) + \sum_{k} d_{1, k} \psi_{1, k}(t) + \dots  + \sum_k d_{J, k} \psi_{J, k}(t).\end{equation*}

Or compactly written:

(6)   \begin{equation*}y_t = \sum_k s_{J, k} \phi_{J,k}(t) + \sum_{j = 1}^J\sum_k d_{j,k} \psi_{j,k}(t).\end{equation*}

One can notice that equation 6 consists mainly of two parts. One part of the equation embodies the smooth component of the wavelet representation and this part will be written as y_t^{S_J} = \sum_k s_{J,k} \phi_{J,k}(t). The other part deals with the detail components of the analysis for j = 1, 2, \dots ,J and we will use y_t^{D_j} = \sum_kd_{j,k}\psi_{j,k}(t) as notation. From this, equations 5 and 6 can be written as follows:

(7)   \begin{equation*}y_t = y_t^{S_J} + \sum_{j = 1}^{J}y_t^{D_j}.\end{equation*}

In these equations, J represents the number of multiresolution levels (or frequencies), k defines the length of the filter, s_{J,k}, d_{1,k}, d_{2,k}, \dots d_{J-1,k}, d_{J,k} are the wavelet coefficients, \phi_{j,k}(t) and \psi_{j,k}(t) are the father and mother functions respectively. These wavelet functions are obtained from the father and mother functions through scaling and translation as follows:

(8)   \begin{equation*}\phi_{J,k}(t) = 2^{-J/2}\phi(2^{-J}t-k),\end{equation*}

(9)   \begin{equation*}\psi_{j,k}(t) = 2^{-j/2}\psi(2^{-j}t-k),\end{equation*}

while the coefficients of the wavelet functions are obtained with the following formulas:

(10)   \begin{equation*}s_J = \int y_t \phi_{J,k}(t)dt,\end{equation*}

(11)   \begin{equation*}d_j = \int y_t \psi_{j,k}(t)dt,\end{equation*}

where j = 1, 2, \dots , J.

Equations 5, 6 and 7 show that the original series can be decomposed in different components, each defined in the time domain and representing the fluctuation of the original time series in a specific frequency. In particular, the first couple of wavelet detail components (small j‘s) represent the higher frequency characteristics. These higher frequencies are able to capture the short-term dynamics of the time series. On the other hand, the last couple of wavelet detail components (large j‘s) represent the lower frequency movements. These capture the long-term dynamics of the time series. Finally, the lowest frequency is captured by the smooth component. This usually represents the trend of the time series.

The first detail component y_t^{D_1} captures oscillations between 2 and 4 months, the second detail component y_t^{D_2} captures oscillations between 4 and 8 months, while detail components y_t^{D_3}, y_t^{D_4}, y_t^{D_5} and y_t^{D_6} capture oscillations with a period of 8-16, 16-32, 32-64, 64-128 months, respectively. Finally, the smooth component y_t^{S_6} captures oscillations with a period longer than 128 months (10.6 years). To give an idea of how these decomposed signals behave, we plotted the original time series of the US equity premium and its MODWTmra decomposition in the figure below.

Visually, it seems that the first detail components display unstable behaviour while the higher detail and smooth components appear to be showing trends in the data.

Forecasting based on wavelet decomposition

So why would we want to decompose our variables of interest into different time frequencies? Well, when we decompose the dependent variable of our time series, we can exploit all the characteristics of our dependent variable in specific frequencies. For example, when we decompose stock market returns we can find different patterns that can predict different outcomes. Essentially, forecasting based on wavelet decomposition forecasts the returns in the decomposed frequencies and subsequently aggregates these forecasts to find the ultimate prediction of the stock return. Numerous studies have found that this method has superior predictive power over the historical average benchmark and other models as well. Thus, next time you want to forecast your portfolio returns, try this method to increase your returns.

This article is written by Sam Ansari

Read more

The Sausage Catastrophe

The Sausage Catastrophe

Introduction Contrary to what you might expect, this article is not actually about sausages. It is not even about food at all. Instead, the sausage catastrophe is a mathematical phenomenon that occurs when studying the theory of finite sphere packing.  Finite...

The Seven Bridges of Königsberg

The Seven Bridges of Königsberg

Imagine you are taking a stroll around the 18th century Prussian city of Königsberg (currently Kaliningrad, Russia). The river Pregel runs through Königsberg and there are two large islands in this river. The islands are connected to each other and to the mainland by...