Forms smoothed spectrum estimates for univariate time series (G. Tunnicliffe Wilson & S.J. Welham).
|Controls printed output (
||Method to be used for smoothing (
||Frequency domain bandwidth for the smoothing window; must be set if
||Specifies the cut-off lag (i.e. the maximum lag of autocovariance used in the spectrum calculation) for
||Determines the number of frequency divisions into which the range [0.0, 0.5] is divided for calculating the spectrum; the default is chosen so that the bandwidth covers about four intervals|
||Probability value used for confidence limits; default 0.9|
||The proportion of data to be tapered (applied for all settings of
||The shape of the trapezium window (a value of 1.0 specifies a rectangular, and 0.0 a triangular window); default 0.5|
||Whether to plot with a log-transformed Y-axis (
||Whether to plot with a log-transformed X-axis (
||What sort of graphics to use (
||Window to be used for plotting; default 1|
||The two pens to be used (after being defined appropriately) for drawing the plots; default
||The series for which the spectrum is to be calculated|
||Scalar specifying that the first N units of the series are to be used, or a variate specifying the first and last units of the series to be used|
||Saves the smoothed spectrum; need not be declared in advance, but will be set up as a variate of the appropriate length within the procedure|
||Scalar to save the multiplier of the spectrum used to calculate the lower limit, or a variate to save the values of the lower limit|
||Scalar to save the multiplier of the spectrum used to calculate the upper limit, or a variate to save the values of the upper limit|
||Saves the frequency values at which the spectrum is calculated|
SMOOTHSPECTRUM calculates smoothed spectrum estimates for a univariate time series. The series is specified in a variate by the
SERIES parameter. The parameter
LENGTH can be used to specify that only part of the series is to be used: if
LENGTH is set to a scalar
N, then only units 1…
N are used; alternatively, it can define a sub-series by being set to a variate of length 2 holding the numbers of the first and last units to be used. The spectrum can be saved by the
SPECTRUM parameter. The method to be used for the smoothing is controlled by the
METHOD option, with settings
lagwindow for Parzen lag window smoothing,
direct for frequency domain smoothing using a trapezium window,
YuleWalker for autoregressive spectrum estimation based on Yule-Walker coefficients, and
exactautoregressive for autoregressive estimation based on exact likelihood estimation of the coefficients.
For frequency domain smoothing (
BANDWIDTH specifies the bandwidth of the smoothing window and option
SHAPE the shape of the trapezium window. The
BANDWIDTH option is also used to determine an appropriate default for the
MAXLAG option if this is not specified with other
METHOD settings: for
MAXLAG specifies the cut-off lag (i.e. the maximum lag of autocovariance used in the spectrum calculation), while for
exactautoregressive, it specifies the order of the autoregression.
DIVISIONS option can define the number of frequency divisions into which the range [0.0, 0.5] is divided for calculating the spectrum; if this is omitted a default is chosen so that the bandwidth covers about four intervals. The frequency values at which the spectrum is calculated can be saved, in a variate, by the
FREQUENCY parameter. The proportion of data to be tapered (relevant to all settings of
exactautoregressive) is controlled by the
TAPER option; by default there is no tapering.
UPPER parameters can be set to scalars to save the scaling factor used to calculate the upper and lower bounds, or to variates to save the upper and lower bounds for the
Printed output can be suppressed by setting the option
PRINT=*; by default,
PROBABILITY option indicates the probability value used for confidence limits; 0.9 is used as the default.
The procedure will also plot the spectrum: option
GRAPHICS controls whether this is done for line printer or on a high-resolution device. With high-resolution graphics, the plot will be produced using the current settings of the window specifed by the
WINDOW option; by default
FRAME directive can be used to set the attributes of the window prior to calling the procedure. The
PENS option controls which pens are to be used for the plots; the attributes of these pens are modified within the procedure. By default pens 1 and 2 are used, but these can be changed by setting option
PENS to a variate of length 2 containing the numbers of the two pens required. Options
XLOG allow the X- and Y-axes to be represented on a logarithmic scale.
A cosine bell window is used for the taper, with lag window and direct spectral smoothing carried out esentially as described in Bloomfield (1976). The autoregressive spectrum estimation uses the standard Yule-Walker equations, as presented for example in Box & Jenkins (1970). These are optionally refined by exact maximum likelihood estimation. The theoretical spectrum of the autoregressive model is then calculated. The error limits are calculated using scaled chi-square distributions. These are quite good for the case of lag window and direct smoothing, but in small samples are only very approximate for the autoregressive estimates. The series values are mean corrected before spectrum estimation, but not trend corrected.
Input and output structures must not be restricted; restriction of the input series to a contiguous set of units can be achieved by use of the
Bloomfield, P. (1976). Fourier Analysis of Time Series: an Introduction. Wiley, New York.
Box, G.E.P. & Jenkins, G.M. (1970). Time Series Analysis, Forecasting and Control. Holden-Day, San Francisco.
Commands for: Time series.
CAPTION 'SMOOTHSPECTRUM example',\ !t('Data from D.F. Andrews & A.M. Herzberg (1985),',\ 'Data: a collection of problems from many fields for the',\ 'student and research worker, Springer-Verlag: New York, p. 369.');\ STYLE=meta,plain VARIATE [VALUES =\ 8.075, 7.819, 7.366, 8.113, 7.380, 7.134, 7.222, 7.768,\ 7.386, 6.965, 6.478, 8.105, 8.060, 7.684, 7.580, 7.093,\ 6.129, 6.026, 6.679, 7.414, 7.112, 7.762, 7.645, 8.639,\ 7.667, 8.080, 6.678, 6.739, 5.569, 5.049, 5.642, 6.808,\ 6.636, 8.241, 7.968, 8.044, 7.791, 7.024, 6.102, 6.053,\ 5.941, 5.386, 5.811, 6.716, 6.923, 6.939, 6.705, 6.914] Profit SMOOTHSPECTRUM [GRAPHICS=line; BANDWIDTH=0.05] Profit SMOOTHSPECTRUM [GRAPHICS=line; METHOD=exactautoregressive; MAXLAG=8] Profit