Learn R Programming

psd (version 0.4-1)

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.

minspan sets the maximum span a tapers object may have, which is necessary because it would be nonsense to have more tapers than the length of the series.

constrain_tapers refines the number of tapers; the method by which it does this is chosen with the constraint.method parameter. See Constraint methods section for descriptions of each method. Below is a summary of the function associated with each constraint.method:

Usage

minspan(tapvec, ...)

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

constrain_tapers(tapvec, tapseq = NULL, constraint.method = c("simple.slope", "loess.smooth", "none"), verbose = TRUE, ...)

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

ctap_simple(tapvec, tapseq = NA, maxslope = 1, ...)

## S3 method for class 'tapers': ctap_simple(tapvec, tapseq = NA, maxslope = 1, ...)

ctap_loess(tapvec, tapseq = NULL, loess.span = 0.3, loess.degree = 1, verbose = TRUE, ...)

## S3 method for class 'tapers': ctap_loess(tapvec, tapseq = NULL, loess.span = 0.3, loess.degree = 1, verbose = TRUE, ...)

ctap_markov()

## S3 method for class 'tapers': ctap_markov()

ctap_friedman()

## S3 method for class 'tapers': ctap_friedman()

Arguments

tapvec
'tapers' object; the number of tapers at each frequency
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?
maxslope
integer; constrain based on this maximum first difference
loess.span
scalar; the span used in loess
loess.degree
scalar; the polynomial degree
...
optional arguments (unused)

Value

  • An object with class 'tapers'.

Details of Constraint Methods

via first differencing (the default){ ctap_simple is the preferred constraint method. The algortihm 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.

In pure-R this algorithm can be very slow; however, here we have included it as dynamically loaded c-code so it it reasonably fast. }

via LOESS smoothing{ ctap_loess uses loess to smooth the taper vector; is can be very slow thanks to quadratic scaling. }

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

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.

See Also

splineGrad, riedsid

Examples

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

Run the code above in your browser using DataLab