tseries (version 0.1-2)

spectrum: Spectrum Estimation

Description

Computes the "discrete spectral average estimator" of the spectrum of x, i.e., the periodogram of x is smoothed with the given weights from the discrete kernel k (see Brockwell and Davies (1991), p. 351, for a definition). If pl is TRUE, then the estimated spectrum is plotted. Additionally, the plot contains information about the "equivalent degrees of freedom" df and the bandwidth bw of k (equation (6.10) of T. Thrall (1983)). If k is a Daniell(0) kernel, then the periodogram itself is returned. Missing values are not handled.

Usage

spectrum (x, k = fejer.kernel(nextn(length(x))%/%2-1,length(x)/10), pl = TRUE, ...)

Arguments

x
a numeric vector or time series.
k
a smoothing kernel of class "kernel".
pl
a logical indicating whether the estimated spectrum is plotted.
...
additional arguments to plot.tsparam.

Value

  • A "tsparam" object.

References

P. J. Brockwell and R. A. Davis (1991): Time Series: Theory and Methods, 2nd Edition, Springer Verlag, NY, pp. 350-365.

T. Thrall (1983): Computer Programming of spectrum estimation, in D. R. Brillinger and P. R. Krishnaiah (Eds.), Handbook of Statistics 3, Time Series in the Frequency Domain, Elsevier Science, North-Holland, pp. 409-437.

See Also

tsparam, kernel

Examples

Run this code
data (sales)  # Reproduce parts of example 11.7.1, Brockwell and Davis (1991)
sal <- diff (sales)
le <- diff (lead)
k <- daniell.kernel (6)
spectrum (le, k)
spectrum (sal, k)

Run the code above in your browser using DataCamp Workspace