Spectral Density Estimation
spectrum function estimates the spectral density of a
spectrum(x, …, method = c("pgram", "ar"))
- A univariate or multivariate time series.
- String specifying the method used to estimate the
spectral density. Allowed methods are
"pgram"(the default) and
"ar". Can be abbreviated.
- Further arguments to specific spec methods or
spectrum is a wrapper function which calls the methods
spec.ar. The spectrum here is defined with scaling
following S-PLUS. This makes the spectral density a density over the
(-frequency(x)/2, +frequency(x)/2], whereas a more common
scaling is \(2\pi\) and range \((-0.5, 0.5]\) (e.g., Bloomfield)
or 1 and range \((-\pi, \pi]\). If available, a confidence interval will be plotted by
plot.spec: this is asymmetric, and the width of the centre
mark indicates the equivalent bandwidth.
An object of class
"spec", which is a list containing at
least the following components:
NULLfor univariate series. For multivariate time series, a matrix containing the squared coherency between different series. Column \( i + (j - 1) * (j - 2)/2\) of
cohcontains the squared coherency between columns \(i\) and \(j\) of
x, where \(i < j\).
NULLfor univariate series. For multivariate time series a matrix containing the cross-spectrum phase between different series. The format is the same as
The default plot for objects of class
"spec" is quite complex,
including an error bar and default title, subtitle and axis
labels. The defaults can all be overridden by supplying the
appropriate graphical parameters.
Bloomfield, P. (1976) Fourier Analysis of Time Series: An Introduction. Wiley. Brockwell, P. J. and Davis, R. A. (1991) Time Series: Theory and Methods. Second edition. Springer. Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S-PLUS. Fourth edition. Springer. (Especially pages 392--7.)
require(graphics) ## Examples from Venables & Ripley ## spec.pgram par(mfrow = c(2,2)) spectrum(lh) spectrum(lh, spans = 3) spectrum(lh, spans = c(3,3)) spectrum(lh, spans = c(3,5)) spectrum(ldeaths) spectrum(ldeaths, spans = c(3,3)) spectrum(ldeaths, spans = c(3,5)) spectrum(ldeaths, spans = c(5,7)) spectrum(ldeaths, spans = c(5,7), log = "dB", ci = 0.8) # for multivariate examples see the help for spec.pgram ## spec.ar spectrum(lh, method = "ar") spectrum(ldeaths, method = "ar")