spec.pgram(x, spans=1, taper=0.1, pad=0, detrend=T, demean=F, plot=F)
spans
= 1, the default, for the raw periodogram.
A modified Daniell smoother has all values equal except
for the 2 end values which are half the size of the others.
The values should be odd integers.
taper * length(x)
} points
at each end of series.
This must take values between
0
and
0.5
.
x
that is to be padded:
{
pad * length(x)
} zeros are added to the end of the series
before computing the periodogram.
TRUE
,
remove a least squares line from each component of the series
before computing periodogram.
TRUE
, remove the mean of each series before computing the periodogram
(
detrend
also removes the mean).
TRUE
, a plot of the spectrum will be provided. See
spec.plot
for details.
0
and
pi
. Because of aliasing the
j
th Fourier frequency corresponds
to a
freq
value of
j/length(x)
times deltat <- 1/tsp(x)[3].
Hence, Fourier frequencies between
0
and
pi
correspond to
freq
values between
0
and
0.5 * deltat
.
x
.
The estimated spectrum is
in decibels (
10*log10(power)
),
where
power
refers to the estimated power spectrum at the
corresponding frequency value in
freq
.
NULL
.
coh
containing the estimated phase spectra between each pair of columns of the series.
The phase spectra are made somewhat continuous by allowing no jumps
of greater than pi in each.
To put them back into the range [0, 2 pi) use the modulus operator
%%
:
e.g.
reducedphase <- phase%%(2*pi)
.
For univariate series this component is
NULL
.
spans
[i] used to smooth the periodogram.
x
.
"Raw Periodogram"
if
spans=1
or
"Smoothed Periodogram"
otherwise.
taper
.
pad
.
detrend
.
demean
.
plot=TRUE
, then a plot is created on the current graphics device.
Only the (central) part of the time series that is free of missing values
is used in the computations.
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.
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.
p <- spec.pgram(log(lynx), pad=1) # Compute and plot Raw Periodogram. p2 <- spec.pgram(log(lynx), pad=1, spans=c(9,7), plot=F) spec.plot(p2,add=T) # Superimpose a Smooth Periodogram.