Spectral Analysis Principles and Tools
In this chapter
This chapter provides some guidance on spectral analysis, which will allow to understand the principle of various spectral analysis tools available in JDemetra+, via Graphical User Interface and R packages.
explanation of spectral graphs here, but description in GUI chap
outputs of tests ?
description of spectral graphs in GUI can be found here
Spectral analysis concepts
A time series
Assuming that the autocovariances
where
Once the Equation 1 is divided by
Therefore, the analysis of the population spectrum in the frequency domain is equivalent to the examination of the autocovariance function in the time domain analysis; however it provides an alternative way of inspecting the process. Because
As
Equation 3 can be presented as:
This implies that if autocovariances are absolutely summable the population spectrum exists and is a continuous, real-valued function of
The shortest cycle that can be distinguished in a time series lasts two periods. The frequency which corresponds to this cycle is
Note that if
The aim of spectral analysis is to determine how important cycles of different frequencies are in accounting for the behaviour of a time series. Since spectral analysis can be used to detect the presence of periodic components, it is a natural diagnostic tool for detecting trading day effects as well as seasonal.
Among the tools used for spectral analysis are the autoregressive spectrum and the periodogram.
The explanations given in the subsections of this node derive mainly from DE ANTONIO, D., and PALATE, J. (2015) and BROCKWELL, P.J., and DAVIS, R.A. (2006).
Spectral density of an ARIMA model
Estimation
Method 1: Periodogram
For any given frequency
To define a periodogram, first consider a vector of complex numbers
where
The Fourier frequencies associated with the sample size
Now the
where
where the coefficients
The sequence of
From Equation 6 and Equation 7 it can be shown that a periodogram decomposes the total sum of squares
If
The orthonormal basis for
Equation 9 can be seen as an OLS regression of
With Equation 9 the total sum of squares
Decomposition of sum of squares into components corresponding to the harmonics
Frequency | Degrees of freedom | Sum of squares decomposition |
---|---|---|
1 | ||
2 | ||
2 | ||
1 | ||
Total |
Source: DE ANTONIO, D., and PALATE, J. (2015).
Obviously, if series were random then each component
Note that in JDemetra+ the periodogram object corresponds exactly to the contribution to the sum of squares of the standardised data, since the series are divided by their standard deviation for computational reasons.
Using the decomposition presented in table above the periodogram can be expressed as:
where
Since
Thus the sample variance of
where
The term
The periodogram ordinate
and for the zero frequency
Once comparing Equation 19 with an expression of the spectral density of a stationary process:
It can be noticed that a periodogram is a sample analogue of the population spectrum. In fact, it can be shown that the periodogram is asymptotically unbiased but inconsistent estimator of the population spectrum
Method 2: Autoregressive spectrum estimation
BROCKWELL, P.J., and DAVIS, R.A. (2006) point out that for any real-valued stationary process
where
The autoregressive spectrum estimator for the series
where:
– frequency, ; innovation variance of the sample residuals; – coefficient estimates of the linear regression of on , .
The autoregressive spectrum estimator is used in the visual spectral analysis tool for detecting significant peaks in the spectrum. The criterion of visual significance, implemented in JDemetra+, is based on the range
A particular value is considered to be visually significant if, at a trading day or at a seasonal frequency
Following the suggestion of SOUKUP, R.J., and FINDLEY, D.F. (1999), JDemetra+ uses an autoregressive model spectral estimator of model order 30. This order yields high resolution of strong components, meaning peaks that are sharply defined in the plot of
The model order can also be selected based on the AIC criterion (in practice it is much lower than 30). A lower order produces the smoother spectrum, but the contrast between the spectral amplitudes at the trading day frequencies and neighbouring frequencies is weaker, and therefore not as suitable for automatic detection.
SOUKUP, R.J., and FINDLEY, D.F. (1999) also explain that the periodogram can be used in the visual significance test as it has as good as those of the AR(30) spectrum abilities to detect trading day effect, but also has a greater false alarm rate, which is defined as the fraction of the 50 replicates for which a visually significant spectral peak occurred at one of the trading day frequencies being considered in the designated output spectra (SOUKUP, R.J., and FINDLEY, D.F. (1999)).
Method 3: Tukey spectrum
The Tukey spectrum belongs to the class of lag-window estimators. A lag window estimator of the spectral density
where
JDemetra+ implements the so-called Blackman-Tukey (or Tukey-Hanning) estimator, which is given by
The choice of large truncation lags
JDemetra+ allows the user to modify all the parameters of this estimator, including the window function.
Identification of spectral peaks
The sections below describe the test, their practical implementation in the Graphical User interface can be found here
In order to decide whether a series has a seasonal component that is predictable (stable) enough, these tests use visual criteria and formal tests for the periodogram. The periodogram is calculated using complete years, so that the set of Fourier frequencies contains exactly all seasonal frequencies.
The tests rely on two basic principles:
The peaks associated with seasonal frequencies should be larger than the median spectrum for all frequencies and;
The peaks should exceed the spectrum of the two adjacent values by more than a critical value.
JDemetra+ performs this test on the original series. If these two requirements are met, the test results are displayed in green. The statistical significance of each of the seasonal peaks (i.e. frequencies
The seasonal and trading day frequencies by time series frequency
Number of months per period (year) | Seasonal frequency | Trading day frequency (radians) |
---|---|---|
12 | ||
4 | ||
3 | ||
2 |
The calendar (trading day or working day) effects, related to the variation in the number of different days of the week per period, can induce periodic patterns in the data that can be similar to those resulting from pure seasonal effects. From the theoretical point of view, trading day variability is mainly due to the fact that the average number of days in the months or quarters is not equal to a multiple of 7 (the average number of days of a month in the year of 365.25 days is equal to
The default frequencies (
where
Other frequencies that correspond to trading day frequencies are: 2.714 (monthly series) and 1.292, 1.850, 2.128 (quarterly series).
In particular, the calendar frequency in monthly data (marked in red on the figure below) is very close to the seasonal frequency corresponding to 4 cycles per year
This implies that it may be hard to disentangle both effects using the frequency domain techniques.
In a Tukey spectrum
Current JDemetra+ implementation of the seasonality test is based on a
where
Two significant levels for this test are considered:
As opposed to the AR spectrum test, which is computed on the basis of the last
Practical implementation in GUI is detailed here
In AR Spectrum definition
The estimator of the spectral density at frequency
where:
denotes the AR(k) coefficient ; .
Soukup and Findely (1999) suggest the use of p=30, which in practice much larger than the order that would result from the AIC criterion. The minimum number of observations needed to compute the spectrum is set to n=80 for monthly data (or n=60) for quarterly series. In turn, the maximum number of observations considered for the estimation is n=121. This choice offers enough resolution, being able to identify a maximum of 30 peaks in a plot of 61 frequencies: by choosing
The traditional trading day frequency corresponding to 0.348 cycles per month is used in place of the closest frequency
JDemetra+ allows the user to modify the number of lags of this estimator and to change the number of observations used to determine the AR parameters. These two options can improve the resolution of this estimator.
The statistical significance of the peaks associated to a given frequency can be informally tested using a visual criterion, which has proved to perform well in simulation experiments. Visually significant peaks for a frequency
, where can be set equal to for all , which guarantees it is not a local peak.
The first condition implies that if we divide the range
Seasonal and trading day frequencies by time series frequency
Number of months per full period | Seasonal frequency | Trading day frequency (radians) |
---|---|---|
12 | ||
6 | ||
4 | ||
3 | ||
2 |
Currently, only seasonal frequencies are tested, but the program allows you to manually plot the AR spectrum and focus your attention on both seasonal and trading day frequencies. Agustin Maravall has conducted a simulation experiment to calculate
Practical implementation in GUI is detailed here
In a Periodogram
The periodogram
where the Fourier frequencies
An orthonormal basis in
where
can be used to project the data and obtain the spectral decomposition
Thus, the periodogram is given by the projection coefficients and represents the contribution of the jth harmonic to the total sum of squares, as illustrated by Brockwell and Davis (1991):
Source | Degrees of freedom |
---|---|
Frequency |
1 |
Frequency |
2 |
Frequency |
2 |
Frequency |
1 |
(excluded if |
|
Total | n |
In JDemetra+, the periodogram of
Defining a F-test
Brockwell and Davis (1991, section 10.2) exploit the fact that the periodogram can be expressed as the projection on the orthonormal basis defined above to derive a test. Thus, under the null hypothesis:
, for Fourier frequencies , for
Because
, for Fourier frequencies , for
where:
-
-
Thus, we reject the null if our F-test statistic computed at a given seasonal frequency (different from
The implementation of JDemetra+ considers simultaneously the whole set of seasonal frequencies (1, 2, 3, 4, 5 and 6 cycles per year). Thus, the resulting test-statistic is:
where
In small samples, the test performs better when the periodogram is evaluated as the exact seasonal frequencies. JDemetra+ modifies the sample size to ensure the seasonal frequencies belong to the set of Fourier frequencies. This strategy provides a very simple and effective way to eliminate the leakage problem.
Practical implementation in GUI is detailed here
Spectral graphs
The section below provides guidance on interpretation of spectral graphs, the display of which in the Graphical User Interface can be found here
The interpretation of the spectral graph is rather straightforward. When the values of a spectral graph for low frequencies (i.e. one year and more) are large in relation to its other values it means that the long-term movements dominate in the series. When the values of a spectral graph for high frequencies (i.e. below one year) are large in relation to its other values it means that the series are rather trendless and contains a lot of noise. When the values of a spectral graph are distributed randomly around a constant without any visible peaks, then it is highly probable that the series is a random process. The presence of seasonality in a time series is manifested in a spectral graph by the peaks on the seasonal frequencies.