g13cb calculates the smoothed sample spectrum of a univariate time series using spectral smoothing by the trapezium frequency (Daniell) window.
- Type: System..::..Int32On entry: , the length of the time series.Constraint: .
- Type: System..::..Int32On entry: whether the data are to be initially mean or trend corrected.
- For no correction.
- For mean correction.
- For trend correction.
- Type: System..::..DoubleOn entry: the proportion of the data (totalled over both ends) to be initially tapered by the split cosine bell taper. (A value of implies no tapering.)Constraint: .
- Type: System..::..Int32On entry: the value of which determines the frequency width of the smoothing window as . A value of implies no smoothing is to be carried out.Constraint: .
- Type: System..::..DoubleOn entry: , the shape parameter of the trapezium frequency window.A value of gives a triangular window, and a value of a rectangular window.If (i.e., no smoothing is carried out), pw is not used.Constraint: .
- Type: System..::..Int32On entry: , the frequency division of smoothed spectral estimates as .
- Type: System..::..Int32On entry: , the order of the fast Fourier transform (FFT) used to calculate the spectral estimates. kc should be a multiple 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.
- For unlogged.
- For logged.
- Type: array<System..::..Double>()An array of size [kc]On entry: the data points.On exit: contains the ng spectral estimates , for , in to (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 supplied time series may be mean or trend corrected (by least squares), and tapered, the tapering factors being those of the split cosine bell:
where and is the tapering proportion.
The unsmoothed sample spectrum
is then calculated for frequency values
where [ ] denotes the integer part.
The smoothed spectrum is returned as a subset of these frequencies for which is a multiple of a chosen value , i.e.,
where . You will normally fix first, then choose so that is sufficiently large to provide an adequate representation for the unsmoothed spectrum, i.e., . It is possible to take , i.e., .
The smoothing is defined by a trapezium window whose shape is supplied by the function
the proportion being supplied by you.
The width of the window is fixed as by you supplying . A set of averaging weights are constructed:
where is a normalizing constant, and the smoothed spectrum obtained is
If no smoothing is required should be set to , in which case the values returned are . Otherwise, in order that the smoothing approximates well to an integration, it is essential that , and preferable, but not essential, that be a multiple of . A choice of would normally be required to supply an adequate description of the smoothed spectrum. Typical choices of and should be adequate for usual smoothing situations when .
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 95% 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
Note: g13cb may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
On entry, , or , or , or , or , or , or , or and , or and , or . On entry, , or kc is not a multiple of l, or kc has a prime factor exceeding , or kc has more than prime factors, counting repetitions.
- This indicates that a serious error has occurred. Check all array subscripts and method parameter lists in calls to g13cb. Seek expert help.
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 then calls g13cb to calculate the univariate spectrum and prints the logged spectrum together with confidence limits.