Last chance! 50% off unlimited learning
Sale ends in
psdcore(X.d, X.frq = NULL, ntaper = as.tapers(1),
ndecimate = 1L, preproc = TRUE,
na.action = stats::na.fail, first.last = TRUE,
plotpsd = FALSE, as.spec = TRUE, refresh = FALSE,
verbose = FALSE, ...) ## S3 method for class 'default':
psdcore(X.d, X.frq = NULL,
ntaper = as.tapers(1), ndecimate = 1L, preproc = TRUE,
na.action = stats::na.fail, first.last = TRUE,
plotpsd = FALSE, as.spec = TRUE, refresh = FALSE,
verbose = FALSE, ...)
X.d
have a linear
trend removed?NA
valuesspec.pgram
estimateas.spec=TRUE
then
an object with class spec
; otherwise the list
object will have information similar to a spec
object, but with a few additional fields. The first.last
parameter is a workaround for
potential bug (under investigation), which causes the
power at the zero and Nyquist frequencies to have
anomalously low values. This argument enables using
linear extrapolation to correct these values.
The feature will be deprecated if the supposed
bug is both identified and fixed.
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]
. } vignette("fftw",package="psd")
) shows how the
performance of a DFT can be affected by series length. }
ndecimate
determines the number of PSD estimates actually computed.
This number is defined as a fraction of the truncated
length, $(1+N/2)/n_d$. Linear interpolation is used.
}
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). }
pspectrum
, riedsid
require(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, ntapers=10, plotpsd=TRUE, refresh=TRUE)
#
# change the sampling frequency to 20
psdcore(X, 20, 10, plotpsd=TRUE, refresh=TRUE)
Run the code above in your browser using DataLab