tapers-constraints {psd} | R Documentation |
Taper constraint methods
Description
In the Riedel-Sidorenko recipe, the number of optimal tapers at each frequency is strongly dependent on the first and second derivatives of the spectrum. It is crucial to enforce constraints on the number of actual tapers applied; this is because the derivatives of "noisy" series can be bogus.
constrain_tapers
refines the number of tapers at each frequency.
minspan
sets bounds on the number of tapers at each frequency.
Usage
constrain_tapers(tapvec, ...)
## S3 method for class 'tapers'
constrain_tapers(tapvec, ...)
## Default S3 method:
constrain_tapers(
tapvec,
tapseq = NULL,
constraint.method = c("simple.slope", "loess.smooth", "none"),
verbose = TRUE,
...
)
minspan(tapvec, ...)
## S3 method for class 'tapers'
minspan(tapvec, ...)
## Default S3 method:
minspan(tapvec, Kmin = NULL, Kmax = NULL, ...)
Arguments
tapvec |
integer or |
... |
optional arguments |
tapseq |
numeric; positions or frequencies – necessary for smoother methods |
constraint.method |
character; method to use for constraints on tapers numbers |
verbose |
logical; should warnings and messages be given? |
Kmin |
numeric; the minimum to set; default is 1 |
Kmax |
numeric; the maximum to set; default is the minimum of either (7/5 max value), or (1/2 series length) |
Details
The method by which constrain_tapers
refines tapers is
set with the constraint.method
argument:
-
'simple.slope'
usectap_simple
-
'loess.smooth'
usesctap_loess
-
'none'
returns unbounded tapers.
minspan
bounds the number of tapers to within
the minimum of either the maximum number of tapers found in the object,
or the half-length of the series, which is necessary because
it would be nonsense to have more tapers than the length of the series.
Details of the constraint methods:
via first differencing (the default)
ctap_simple
is the preferred constraint method.
The algorithm uses first-differencing to modify the number
of tapers in the previous position. Effectively, the constraint
is based on a causal, 1st-order Finite Impulse-response Filter (FIR)
which makes the method sensitive to rapid changes in the number of tapers;
naturally, smoother spectra tend to produce less fluctuation in taper numbers,
which makes this well suited for adaptive processing.
This produces, generally, the most stable results, meaning repeatedly running the constraint will not change values other than on the first execution; the same cannot be said for the other methods, which are also considerably more expensive to use.
via LOESS smoothing
ctap_loess
uses loess
to smooth the taper vector; is
can be very slow thanks to quadratic scaling.
Value
constrain_tapers
: an object with class 'tapers'
; minspan
: a vector
Warning
ctap_loess
results tend to be strongly dependent on
the tuning parameters given to loess
(for obvious reasons); hence,
some effort should be given to understand their effect, and/or re-tuning them if needed.
Author(s)
A.J. Barbour and R.L. Parker
See Also
riedsid
, ctap_simple
, ctap_loess
, tapers
Examples
## Not run: #REX
library(psd)
##
## Taper constraint procedures
##
data(magnet)
X <- magnet$clean
##
## spectrum
PSD <- psdcore(X, ntaper=10, refresh=TRUE)
## optimize tapers
kopt <- riedsid(PSD)
kopt.loess <- riedsid(PSD, c.method="loess.smooth")
# the preferred function:
kopt2 <- riedsid2(PSD)
#
plot(as.tapers(kopt2), ylim =c(0, 60))
lines(as.tapers(kopt.loess), col='black')
lines(as.tapers(kopt), col='black', lwd=2)
##
## To compare all the methods at once:
demo("ctap")
## End(Not run)#REX