Learn R Programming

psd (version 1.0-0)

tapers-constraints: 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, ...)

## S3 method for class 'default': constrain_tapers(tapvec, tapseq = NULL, constraint.method = c("simple.slope.rcpp", "simple.slope", "loess.smooth", "none"), verbose = TRUE, ...)

minspan(tapvec, ...)

## S3 method for class 'tapers': minspan(tapvec, ...)

## S3 method for class 'default': minspan(tapvec, Kmin = NULL, Kmax = NULL, ...)

Arguments

tapvec
'tapers' object; the number of tapers at each frequency
...
optional arguments sent to the constrain function (e.g. ctap_simple)
tapseq
vector; 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)

Value

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.

Details

The method by which constrain_tapers refines tapers is set with the constraint.method argument:

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_rcpp is the preferred constraint method (in previous versions ctap_simple was). 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.

}

See Also

riedsid, ctap_simple_rcpp, ctap_loess, tapers

Examples

Run this code
#REX
library(psd)
##
## Taper constraint procedures
##
data(magnet)
X <- magnet$clean
##
## spectrum, then riedsid
PSD <- psdcore(X, ntaper=10, refresh=TRUE)
#
kopt <- riedsid(PSD)
kopt.loess  <- riedsid(PSD, c.method="loess.smooth")
#
plot(kopt, log.y=TRUE, ylim =c(.1, 3e2))
lines(kopt.loess)
##
##
## To compare all the methods at once:
demo("ctap")
###REX

Run the code above in your browser using DataLab