psdcore {psd} | R Documentation |
Multitaper power spectral density estimates of a series
Description
Compute power spectral density (PSD) estimates
for the input series using sine multitapers.
This is used by pspectrum
for the adaptive
estimation procedure.
Usage
psdcore(X.d, ...)
## S3 method for class 'ts'
psdcore(X.d, ...)
## S3 method for class 'matrix'
psdcore(X.d, X.frq, ...)
## Default S3 method:
psdcore(
X.d,
X.frq = NULL,
ntaper = as.tapers(5),
preproc = TRUE,
na.action = stats::na.fail,
plot = FALSE,
refresh = FALSE,
verbose = FALSE,
fast = FALSE,
ndecimate,
...
)
Arguments
X.d |
the series to estimate a spectrum for |
... |
additional parameters |
X.frq |
scalar; the sampling information (see section Sampling) |
ntaper |
scalar, vector, or |
preproc |
logical; should |
na.action |
function to deal with |
plot |
logical; should the estimates be shown compared to the |
refresh |
logical; ensure a free environment prior to execution |
verbose |
logical; should warnings and messages be given? |
fast |
logical; use the faster method? |
ndecimate |
now ignored |
Details
Tapering
The parameter ntaper
specifies the number of sine tapers to be used
at each frequency: equal tapers at each frequency for a scalar;
otherwise, use ntaper[j]
sine tapers at frequency[j]
.
Truncation
The series, with length N
, is necessarily truncated so that 1+N/2
evenly
spaced frequencies are returned. This truncation makes the series length “highly composite",
which the discrete Fourier transform (DFT) is most efficient.
The "fftw" vignette (accessed with vignette("fftw",package="psd")
) shows
how the performance of a DFT can be affected by series length.
Decimation
No longer supported. Setting ndecimate
will not affect the results
Sampling
If X.frq
is NULL, the value is assumed to be 1, unless X.d
is a 'ts'
object.
If X.frq > 0
it's assumed the value represents frequency (e.g. Hz).
If X.frq < 0
it's assumed the value represents interval (e.g. seconds).
Value
An on object of class 'amt','spec'
, which has a structure similar to a regular 'spec'
object,
but with a few additional fields, invisibly.
Author(s)
A.J. Barbour; original algorithm by R.L. Parker.
See Also
pspectrum
, riedsid
, parabolic_weights
, pgram_compare
Examples
## Not run: #REX
library(psd)
##
## Multitaper PSD estimation
##
set.seed(1234)
X <- rnorm(1e3)
# use the defaults, and appeal to plot.spec
# sampling assumed to be 1
plot(psdcore(X))
# use more tapers, compare to stats::spectrum, and clear
# env data from the previous calculation
psdcore(X, ntaper=10, plot=TRUE, refresh=TRUE)
# change the sampling frequency to 20
psdcore(X, X.frq=20, ntaper=10, plot=TRUE, refresh=TRUE)
## End(Not run)#REX