Learn R Programming

psd (version 1.0-0)

psdcore: 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 'default': psdcore(X.d, X.frq = NULL, ntaper = as.tapers(5), preproc = TRUE, na.action = stats::na.fail, plot = FALSE, refresh = FALSE, verbose = 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 tapers; the number of sine tapers to apply at each frequency
preproc
logical; should X.d have a linear trend removed?
na.action
function to deal with NA values
plot
logical; should the estimates be shown compared to the spectrum-based estimates? Note that this will add some computation time, since the cosine-tapered periodogram is calculated inside
refresh
logical; ensure a free environment prior to execution
verbose
logical; should warnings and messages be given?
ndecimate
now ignored

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.

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). }

See Also

pspectrum, riedsid, parabolic_weights, pgram_compare

Examples

Run this code
#REX
library(psd)
##
## Multitaper PSD estimation
##
set.seed(1234)
X <- rnorm(1e3)
#
# use the defaults, and appeal to plot.spec
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, 20, 10, plot=TRUE, refresh=TRUE)#REX

Run the code above in your browser using DataLab