signal: Wavelet-Based Signal Estimation

View source: R/signal.R

signalR Documentation

Wavelet-Based Signal Estimation

Description

This function is a generic function that estimates a signal by using several methods of wavelet shirinkage and thresholding available in R.

Usage

signal(x, wt = NULL, ...)

Arguments

x

A time series or a numeric vector. If the data is not of length 2 ^ J for some integer J, the function padVector of the WiSEBoot package increases the length of data to achieve the particular length requirement based on reflection type. See the help of the mentioned function for details. After the signal computation, the length is again adjusted for the orginal length.

wt

NULL, "dwt" or "modwt". If EbayesThresh is computed and wt = NULL, dwt wavelet transform is the default.

...

Addtional parameters (see details).

Details

This function is a wrapper to estimate wavelet-based signal through 3 available packages in R: wmtsa, EbayesThres and wavethresh. The advantage of using wavsigmap::signal is that the way of obtaining the signal is uniform. User just select the parameters and get the signal directly. So, the focus of this function is the signal only, not the wavelet coefficients.

Addtional parameters to pass in "..." are described in the following help pages:

  • wavShrink

  • dwt (or modwt) and ebayesthresh.wavelet

  • wd and threshold.wd

Parameters should be passed consistently for one of the three options above or an error messsage will be presented. Do not mix paramenters from different methods. If one want to estimate a signal from wavShrink the parameter choice is restricted to that function. For example, n.level = 5 and a = NA gives an error because n.level is related to wavShrink and a to ebayesthresh.wavelet. To use this two paramenters, the correct specifation would be n.levels = 5 and a = NA (note that n.levels is a parameter of the dwt/modwt).

If any parameter of the dwt (or modwt) is passed in "...", the signal function automatically implies ebayesthresh.wavelet method for estimating the wavelet signal. For example, if only the wavelet function is passed on "...", the choice could be wf = "haar" or wavelet = "haar". Note that wf is a paramenter of dwt and wavelet is one of wavShrink. However, the signal estimated for that single choice is differente becase wf implies ebayesthresh.wavelet and wavelet = "haar" calls wavShrink.

The parameter xtr of the function ebayesthresh.wavelet is automatically obtained from
wavsigmap::signal, then it must not be passed. The same observation is true for wd of the function threshold.wd.

It is importante to mention one more thing: the parameter type appears two times in package wavethresh, in the function wd and threshold.wd. So, as showed in the example bellow, if this parameter should be used in these two functions it needs to be passed as a string vector. For example, type = c("hard", "station") use "hard" in threshold.wd and "station" in wd. The order is not imporatant and it is not necessary to pass the two type simultaneously.

In summary, based on paramenters passed in "..." this function select the appropriated method to estimate the signal. If nothing exist in "..." and wt = NULL, the default is the same as in wavShrink.

Value

A time series or a vector representing the wavelet-based signal estimation. The length of the signal is the same as the orignal data.

References

  • Bernard W. Silverman, Ludger Evers, Kan Xu, Peter Carbonetto and Matthew Stephens (2017). EbayesThresh: Empirical Bayes Thresholding and Related Methods. R package version 1.4-12. https://CRAN.R-project.org/package=EbayesThresh

  • William Constantine and Donald Percival (2017). wmtsa: Wavelet Methods for Time Series Analysis. R package version 2.0-3. https://CRAN.R-project.org/package=wmtsa

  • Brandon Whitcher (2019). waveslim: Basic Wavelet Routines for One-, Two- And Three-Dimensional Signal Processing. R package version 1.7.5.1.
    https://CRAN.R-project.org/package=waveslim

  • Guy Nason (2016). wavethresh: Wavelets Statistics and Transforms. R package version 4.6.8. https://CRAN.R-project.org/package=wavethresh

See Also

map_wav_args

Examples

# wmtsa::wavShrink
wavsigmap::signal(GDPC1)

# EbayesThresh::ebayesthresh.wavelet
wavsigmap::signal(GDPC1 , a = NA)

# wavethresh::threshold
wavsigmap::signal(GDPC1, boundary = 2,
                  filter.number = 10, policy = "cv",
                  type = c("hard", "station"))

nelson16silva/wavsigmap documentation built on March 7, 2023, 10:45 a.m.