g13ca calculates the smoothed sample spectrum of a univariate time series using one of four lag windows – rectangular, Bartlett, Tukey or Parzen window.
Public Shared Sub g13ca ( _ nx As Integer, _ mtx As Integer, _ px As Double, _ iw As Integer, _ mw As Integer, _ ic As Integer, _ nc As Integer, _ c As Double(), _ kc As Integer, _ l As Integer, _ lg As Integer, _ xg As Double(), _ <OutAttribute> ByRef ng As Integer, _ stats As Double(), _ <OutAttribute> ByRef ifail As Integer _ )
- Type: System..::..Int32On entry: , the length of the time series.Constraint: .
- Type: System..::..Int32On entry: if covariances are to be calculated by the method (), mtx must specify whether the data are to be initially mean or trend corrected.
Constraint: if ,If covariances are supplied (), mtx is not used.
- For no correction.
- For mean correction.
- For trend correction.
- Type: System..::..DoubleOn entry: if covariances are to be calculated by the method (), px must specify the proportion of the data (totalled over both ends) to be initially tapered by the split cosine bell taper.Constraint: .
- Type: System..::..Int32On entry: the choice of lag window.
- Type: System..::..Int32On entry: , the ‘cut-off’ point of the lag window. Windowed covariances at lag or greater are zero.Constraint: .
- Type: System..::..Int32On entry: indicates whether covariances are to be calculated in the method or supplied in the call to the method.
- Covariances are to be calculated.
- Covariances are to be supplied.
- Type: System..::..Int32On entry: the number of covariances to be calculated in the method or supplied in the call to the method.Constraint: .
- Type: System..::..Int32On entry: if , kc must specify the order of the fast Fourier transform (FFT) used to calculate the covariances. kc should be a product of small primes such as where is the smallest integer such that , provided .If , that is covariances are supplied, kc is not used.
- Type: System..::..Int32On entry: , the frequency division of the spectral estimates as . Therefore it is also the order of the FFT used to construct the sample spectrum from the covariances. l should be a product of small primes such as where is the smallest integer such that , provided .
- Type: System..::..Int32On entry: indicates whether unlogged or logged spectral estimates and confidence limits are required.
- Type: array<System..::..Double>()An array of size [nxg]On entry: if the covariances are to be calculated, then xg must contain the nx data points. If covariances are supplied, xg may contain any values.On exit: contains the ng spectral estimates, , for in to respectively (logged if ). The elements , for contain .
- Type: array<System..::..Double>()An array of size On exit: four associated statistics. These are the degrees of freedom in , the lower and upper confidence limit factors in and respectively (logged if ), and the bandwidth in .
The smoothed sample spectrum is defined as
where is the window width, and is calculated for frequency values
where denotes the integer part.
The autocovariances may be supplied by you, or constructed from a time series , as
the fast Fourier transform (FFT) being used to carry out the convolution in this formula.
The time series may be mean or trend corrected (by classical least squares), and tapered before calculation of the covariances, the tapering factors being those of the split cosine bell:
where and is the tapering proportion.
The smoothing window is defined by
which for the various windows is defined over by
The sampling distribution of is approximately that of a scaled variate, whose degrees of freedom is provided by the method, together with multiplying limits , from which approximate confidence intervals for the true spectrum may be constructed as . Alternatively, log may be returned, with additive limits.
The bandwidth of the corresponding smoothing window in the frequency domain is also provided. Spectrum estimates separated by (angular) frequencies much greater than may be assumed to be independent.
Bloomfield P (1976) Fourier Analysis of Time Series: An Introduction Wiley
Jenkins G M and Watts D G (1968) Spectral Analysis and its Applications Holden–Day
Errors or warnings detected by the method:
On entry, , or and , or and , or , or , or , or , or , or , or , or , or and , or and . On entry, , or kc has a prime factor exceeding , or kc has more than prime factors, counting repetitions.This error only occurs when .
The FFT is a numerically stable process, and any errors introduced during the computation will normally be insignificant compared with uncertainty in the data.
This example reads a time series of length . It selects the mean correction option, a tapering proportion of , the Parzen smoothing window and a cut-off point for the window at lag . It chooses to have auto-covariances calculated and unlogged spectral estimates at a frequency division of . It then calls g13ca to calculate the univariate spectrum and statistics and prints the autocovariances and the spectrum together with its confidence multiplying limits.