This site is best viewed in a browser that conforms to web standards.

Button
Button
Button
Button
Button

Button
Button
Button
Button

Turmsegler

Spectral Analysis of Time Series

In the investigation of time series, the results of spectral analyses can reveal interesting details. Moreover, on the basis of the information thus extracted, it becomes possible to parameterize other transformation procedures in such a way that they act as ideal filters for suppressing irrelevant information.

The following examples are intended merely to give you an idea of what is possible by means of spectral analysis. A comprehensive discussion of this topic would easily fill an entire scientific volume. Hence, we will limit ourselves at this point to one field of application and two simple examples that can be grasped without in-depth knowledge of physics and mathematics: the investigation of cyclical behavior patterns and the extraction of parameters for information filters.

In order to explain our approach, we begin with an experimental time series. Trigonometric functions - such as sin(x), for example - are very suitable for generating experimental series with known periods. In the following illustration, we generated an experimental time series in this manner.

Sine Wave

Fig. 1: The time series shown in this illustration has a constant period of 13 days. The red section of the curve indicates a complete period. Due to rounding errors in the calculation, the individual curve sections do not appear completely identical. For the analysis, however, this is of no significance.

With the knowledge regarding the uniform cyclical behavior of the time series, it is easy to predict what value the signal will have on day 52 - the same value as 13 days earlier on day 39, i.e. 0. In this example, it is still easy to recognize both the cyclical behavior as well as the duration of the period in the graphical representation.

The issue gets more complicated, however, if we assemble the experimental time series from sine curves of varying periods.

Composite Sine Wave

Fig. 2: The curve above is the result of the addition of three sine curves with varying periods. The fact that this series behaves in a strictly cyclical pattern is apparent at best to a trained eye. With the help of a Fourier transform, this series can be transformed from the time domain to the frequency domain, in order to investigate the series in terms of its cyclical behavior.

For the untrained observer, it is no longer obvious that what is represented in Fig. 2 is a purely cyclical time series. The superposition of three varying periods produces ever changing patterns. Now it would not be easy to predict the value of the signal on day 160, a day not represented in the graph.

With the help of spectral analysis, however, the above time series can be analyzed until the cyclical behavior becomes visible. The periods too are easily determined. The prerequisite for such an analysis is the transform of the represented time series in an alternative space of observation - the frequency domain. The time series is regarded as the result of several superimposed signals of varying frequencies. This conversion is carried out by means of a Fourier transform.

Fourier Transform of Composite Sine Wave

Fig. 3: The Fourier transform is a translation of the time series from the time domain into the frequency domain. Already the graphical representation of the transformed time series shows that we are dealing with a series featuring distinctive cycles. For the largest portion of the frequency spectrum shows no activity, while distinctive peaks are observed in certain areas.

The graphical representation already reveals that we are dealing with a readily intelligible problem. The original time series contains distinctive cycles, recognizable by the peaks in intensity. The question is now how many frequencies there are and what their precise values are.

In order to investigate this issue, a power spectrum is generated from the transformed time series. In this type of graph (see Fig. 4), the periods are represented on the x-axis, while the intensity of the frequency corresponding to each period is represented on the y-axis.

Power Spectrum of Composite Sine Wave

Fig. 4: The power spectrum illustrates the energy distribution across the various frequency ranges that have already been converted into periods. Thus, we can see from the power spectrum of the Fourier transform shown in Fig. 3 that the original time series is the result of only three superimposed uniform movements. The periods too can be gleaned from the graph: 13, approx. 9 and 4, which corresponds to the formulas for generating the experimental time series.

The power spectrum represented in Fig. 4 contains the answer to our question. The time series under consideration is the result of three superimposed uniform phenomena of varying periods of 13, 9 and 4 days. By means of some additional investigations, it is now also possible to determine how the start of the individual cycles is staggered. This is all one needs to know in order to extend the time series represented in Fig. 2 and to be able to determine the value of the signal on day 160.

Power Spectrum of Composite Sine Wave (log)

Fig. 5: A logarithmic scaling of the x-axis of the power spectrum represented in Fig. 4 reveals more information. We are not dealing with a "clean" cyclical phenomenon. The uniform increase in intensity on both sides of the peaks clearly reflects the above-mentioned rounding errors in the generation of the experimental time series.

The result of these investigations, of course, is hardly surprising, since we know that the experimental time series was constructed precisely according to a corresponding mathematical formula. Things get exciting, however, if we apply spectral analysis to a "real" time series.

For this example, we chose a section of a chart of the IBM stock. Since the Fourier transform presupposes a few boundary conditions, we already had to perform a first transform on the original time series. In place of the actual closing prices on a particular day, we use an alternative form of representation, the day-to-day percent deviations (daily returns) of the closing prices.

We can now transform the time series thus obtained into the frequency domain as described above and generate a power spectrum for analysis.

Power Spectrum of a Price Time Series

Fig. 6: Spectral analysis, of course, can also be applied to real time series. In this illustration, you see the power spectrum of the daily changes in price (daily returns) of the IBM stock. The spectrum reveals that this series is the result of a great number of superimposed cycles. Dominant cycles are discernible as well, however.

It is not surprising that this power spectrum differs substantially from that of the experimental time series. The time series of the daily returns is the result of the superposition of numerous cyclical phenomena. Now, the analysis holds two significant discoveries. On the one hand, we are able to ascertain that there are dominant cycles in the development of the stock. The most dominant of these phenomena has a period of 8 1/2 days. The second important discovery concerns those frequency ranges, the energy level of which lies below a certain limit, e.g. 4000. These frequencies are the result of rather accidental movements. From the standpoint of information retrieval this constitutes "white noise": there is something, but it does not really signify anything, as it were.

This "noise" impedes the analyst and, of course, also his analysis software in the investigation of the time series. Thus it would be desirable to filter out all of the frequency ranges that transmit this "noise". In order to achieve this, we have several options. The most elegant option is to use digital filters as are used in signal processing, for example, in order to filter out the crackling from old recordings on vinyl records. These digital filters work directly on the transformed series. Following the filtering, the series is transformed back. The result is a smoothed out time series that only contains the dominant informational components.

A less elegant method, but one that is much easier to implement, is the use of static filters. Most traders with an interest in technology are familiar with this type of filter. A simple moving average, for example, filters out phenomena with shorter periods than its specified time span. Particularly because of their filtering function, moving averages are popular in technical trading. The difficult part for the analyst is always to determine the optimal time span of the moving averages used.

The power spectrum of a time series certainly provides insight into what span a moving average should have so as to filter out the "noise" in the most effective way without thereby eliminating the significant information as well. Thus, we can see in the power spectrum of the IBM stock shown in Fig. 6 that moving averages with a period greater than 8.5 would filter out the dominant informational components and hence impede rather than advance the analysis. A moving average with a span of five days, on the other hand, would be practical. Such a filter preserves the dominant informational components, while filtering out all of those frequency ranges that lie further to the right in the power spectrum, i.e. that have periods of less than five days.

If one performs a Fourier transform on the time series of such a moving average and observes the resulting power spectrum, the filtering function becomes evident. In the range of frequencies with periods smaller than the span of the moving average, the intensities in the power spectrum will then tend toward 0.