Time Series Analysis Package
Details
The SPECTRA object uses the finite Fourier transform to decompose data series into a sum of sine and cosine terms of different amplitudes and wavelengths. The finite Fourier transform decomposition of the series is
where
Functions of the Fourier coefficients and
can be plotted against frequency or against wavelength to form periodograms. The amplitude periodogram
is defined as
The periodogram is an estimate at the discrete frequencies
of the spectral density function that characterizes the series
. Smoothing the periodogram enables an improved spectral density estimate with reduced variance and bias to be achieved at these points. Smoothing can be accomplished either by using a spectral window smoothing function or by applying a lag window filter to the series autocovariance function.
When the Value of the DOMAIN argument is FREQUENCY, the spectral density estimates are computed by using the following equation to smooth the periodogram ordinates:
where is the spectral window function whose form is specified by either the SetKernel method or the SetWeights method; M is the kernel scale parameter, which acts as a frequency scaling factor in the spectral window smoothing function; and values of
that fall outside
are mapped to values inside this range by the equations presented previously.
When the Value of the DOMAIN argument is TIME, the spectral density values are estimated by applying a lag window filter, , to the series autocovariance function. Then, the spectral density estimate can be computed from the filtered autocovariance function by using the following equation:
In this case, the kernel scale parameter, M, serves as a scale factor for the lag length, h, in the time domain. In the lag window formulation, the spectral density estimate is a consistent estimator as under the conditions
for
and
. These conditions lead to the following parameterization of M:
where the values and
satisfy the consistency conditions. To specify the kernel scale parameter explicitly, set c to the desired scale factor and set
.
For uniformity and computational efficiency, all spectral density estimates are calculated using a spectral window weighting function, , which is applied to the periodogram ordinates. In the case where the Value of the DOMAIN argument is TIME, the effective spectral window weighting function is computed by the following equation:
Because the kernel scale parameter, M, serves as a lag scale factor in the time domain and as a bandwidth scale factor in the frequency domain, the impact of M on spectral density estimates depends on the Value of the DOMAIN argument. When the Value of the DOMAIN argument is specified to be FREQUENCY, increasing values of M decrease variance and increase bias in the spectral density estimates; when the Value of the DOMAIN argument is TIME, increasing values of M increase variance and decrease bias.
Using Kernel Specifications
You can specify one of 10 different kernel smoothing functions in the SPECTRA object. Five smoothing functions are available in the SetKernel method, and five complementary smoothing functions that correspond to lag window filters are available when the SetKernel method is used and the Value of the DOMAIN argument is TIME.
For example, a Parzen kernel with a support of 11 periodogram ordinates in the frequency domain can be specified using the SetKernel method:
rc = SetKernel('PARZEN', 5, 0);
The SPECTRA class of the TSA package supports the following spectral window kernel functions in the frequency domain, where :
BARTLETT (Bartlett kernel):
PARZEN (Parzen kernel):
QS (quadratic spectral kernel):
TUKEY (Tukey-Hanning kernel):
TRUNCAT (truncated kernel):
When the Value of the DOMAIN argument is TIME, the five preceding kernel functions are interpreted as lag window filters on the autocovariance function. The lag window kernel functions correspond to the following spectral window smoothing functions, where :
BARTLETT (Bartlett equivalent lag window filter):
PARZEN (Parzen equivalent lag window filter):
QS (quadratic spectral equivalent lag window filter):
TUKEY (Tukey-Hanning equivalent lag window filter):
TRUNC (truncated equivalent lag window filter):
Using Specification of Weighting Constants
You can specify any number of weighting constants. The constants are interpreted symmetrically around the middle weight. The middle constant (or the constant to the right of the middle if an even number of weight constants is specified) is the relative weight of the current periodogram ordinate. The constant immediately to the right of the middle constant is the relative weight of the next periodogram ordinate, and so on. The actual weights that are used in the smoothing process are the weights that are specified in the SetWeights method, which are scaled so that they sum to 1.
The moving average calculation reflects at each end of the periodogram to accommodate the periodicity of the periodogram function when there are not enough periodogram ordinates.
For example, a simple triangular weighting can be specified using the following WEIGHTS option:
array group1[5]/nosymbols;group1[1]=1;group1[2]=2;group1[3]=3;
group1[4]=2;group1[5]=1;
rc = spectra.SetWeights(group1);
Computational Method
If the number of observations, T, factors into prime integers that are less than or equal to 23 and the product of the square-free factors of T is less than 210, then the SPECTRA object uses the fast Fourier transform that was developed by Cooley and Tukey (1965) and implemented by Singleton (1969). If T cannot be factored in this way, then the SPECTRA object uses a Chirp-Z algorithm similar to that proposed by Monro and Branch (1977).
Missing Values
Missing values are replaced with an estimate of the mean to perform spectral analyses. This treatment of a series with missing values is consistent with the approach of Priestley (1981).