spectrum(bats) | R Documentation |
The spectrum
function estimates the spectral density of a
time series. This is just a wrapper function which calls the methods
spec.pgram
and spec.ar
.
The generic function plot
has a method for spec
objects.
spectrum(x, method=c("pgram","ar"), plot = TRUE, ...) plot.spec(spec.obj, add=FALSE, ci=0.95, ...)
x |
A time series. |
method |
String specifying the method used to estimate the spectral density. Allowed methods are "pgram" (the default) and "ar". |
plot |
logical. If TRUE then the spectral density is plotted. |
... |
Further arguments to specific spec methods. |
spec.obj |
An object of class spec . |
add |
logical. If TRUE then lines are added to the
existing plot. |
ci |
Coverage probability for confidence interval. Plotting of the
confidence bar is suppressed if ci = NULL . |
... |
Further graphical parameters. |
spec
, which is a list containing at
least the following elements:
freq |
vector of fourier frequencies at which the spectral density is estimated. |
spec |
Vector (for univarite series) or matrix (for multivariate
series) of estimates of the spectral density at frequencies
corresponding to freq . |
coh |
NULL for univariate series. For multivariate time
series, a matrix containing the squared coherency between different
series. Column i + (j - 1) * (j - 2)/2 of coh
contains the squared coherency between columns i and j
of x , where i>j. |
phase |
NULL for univariate series. For multivariate
time series a matrix containing the cross-spectrum phase between
different series. The format is the same as coh . |
series |
The name of the time series. |
method |
The method used to calculate the spectrum. |
The default plot for spec
objects 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.
Martyn Plummer