spectrum(x, method="pgram", plot=T, ...)
method="ar"
, then this can also be
a list as returned by the
ar
function.
"ar"
or
"pgram"
depending on whether an autoregressive
model or a smoothed periodogram is to be used in estimating the spectrum.
method="pgram"
, then the possible arguments
and their defaults are:
spans=1
,
taper=0.1
,
pad=0
,
detrend=TRUE
,
demean=FALSE
.
The most useful of these is
spans
which should be a vector of odd integers
specifying spans of Daniell smoothers used on the periodogram.
See
spec.pgram
for further information.
method="ar"
, additional arguments can be
n.freq
(the number of
frequencies at which the spectrum is to be estimated -- the default is
1
plus half the length of the series), and
frequency
(the frequency of
the observations of the time series -- the default is the frequency of
x
).
See
spec.ar
.
spec.pgram
if
method="pgram"
, or as
returned by
spec.ar
if
method="ar"
.
The most important components are
freq
(the frequencies at which the
spectrum is estimated) and
spec
(a vector or matrix of spectral estimates
in decibels).
If the series is multivariate, components
coh
and
phase
give the
coherency and phase of the series.
plot=TRUE
, a plot is created on the current graphics device.
Only the (central) part of the series that is free of missing values is used.
If
method="pgram"
, the spectrum is estimated by taking
the discrete Fourier transform of the (detrended then tapered then padded) data.
The squared modulus of this transform is then smoothed by a
sequence of running averages.
If
method="ar"
, the parameters of an autoregressive model fitted to
x
,
and its prediction variance are used to compute the spectral estimate of
x
.
See Bloomfield (1976) for a discussion of the methods.
Bloomfield, P. (1976).
Fourier Analysis of Time Series: An Introduction.
Wiley, New York.
The chapter "Analyzing Time Series" of the S-PLUS Guide to Statistical and Mathematical Analysis.
spectrum(log(lynx), pad=1, spans=3) # Compute and plot Raw Periodogram. p2 <- spectrum(log(lynx), method="ar", plot=F) spec.plot(p2,add=T) # Superimpose an autoregressive spectrum