# ebayesthresh.wavelet: Empirical Bayes thresholding on the levels of a wavelet... In stephenslab/EbayesThresh: Empirical Bayes Thresholding and Related Methods

## Description

Apply an Empirical Bayes thresholding approach level by level to the detail coefficients in a wavelet transform.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```ebayesthresh.wavelet(xtr, vscale = "independent", smooth.levels = Inf, prior = "laplace", a = 0.5, bayesfac = FALSE, threshrule = "median") ebayesthresh.wavelet.dwt(x.dwt, vscale = "independent", smooth.levels = Inf, prior = "laplace", a = 0.5, bayesfac = FALSE, threshrule = "median") ebayesthresh.wavelet.wd(x.wd, vscale = "independent", smooth.levels = Inf, prior = "laplace", a = 0.5, bayesfac = FALSE, threshrule = "median") ebayesthresh.wavelet.splus(x.dwt, vscale = "independent", smooth.levels = Inf, prior = "laplace", a = 0.5, bayesfac = FALSE, threshrule = "median") ```

## Arguments

 `xtr` The wavelet transform of a vector of data. The transform is obtained using one of the wavelet transform routines in R or in S+WAVELETS. Any choice of wavelet, boundary condition, etc provided by these routines can be used. `x.dwt` Wavelet transform input for `ebayesthresh.wavelet.dwt`. `x.wd` Wavelet transform input for `ebayesthresh.wavelet.wd`. `vscale` Controls the scale used at different levels of the transform. If `vscale` is a scalar quantity, then it will be assumed that the wavelet coefficients at every level have this standard deviation. If `vscale = "independent"`, the standard deviation will be estimated from the highest level of the wavelet transform and will then be used for all levels processed. If `vscale="level"`, then the standard deviation will be estimated separately for each level processed, allowing standard deviation that is level-dependent. `smooth.levels` The number of levels to be processed, if less than the number of levels of detail calculated by the wavelet transform. `prior` Specification of prior to be used for the coefficients at each level, conditional on their mean being nonzero; can be `cauchy` or `laplace`. `a` Inverse scale ( i.e., rate) parameter if Laplace prior is used. Ignored if Cauchy prior is used. If, on entry, `a=NA` and `prior="laplace"`, then the scale parameter will also be estimated at each level by marginal maximum likelihood. If `a` is not specified then the default value 0.5 will be used. `bayesfac` If `bayesfac=TRUE`, then whenever a threshold is explicitly calculated, the Bayes factor threshold will be used. `threshrule` Specifies the thresholding rule to be applied to the coefficients. Possible values are `median` (use the posterior median); `mean` (use the posterior mean); `hard` (carry out hard thresholding); `soft` (carry out soft thresholding).

## Details

The routine `ebayesthresh.wavelet` can process a wavelet transform obtained using the routine `wd` in the WaveThresh R package, the routines `dwt` or `modwt` in the waveslim R package, or one of the routines (either dwt or nd.dwt) in S+WAVELETS.

Note that the wavelet transform must be calculated before the routine ebayesthresh.wavelet is called; the choice of wavelet, boundary conditions, decimated vs nondecimated wavelet, and so on, are made when the wavelet transform is calculated.

Apart from some housekeeping to estimate the standard deviation if necessary, and to determine the number of levels to be processed, the main part of the routine is a call, for each level, to the smoothing routine `ebayesthresh`.

The basic notion of processing each level of detail coefficients is easily transferred to transforms constructed using other wavelet software. Similarly, it is straightforward to modify the routine to give other details of the wavelet transform, if necessary using the option `verbose = TRUE` in the calls to `ebayesthresh`.

The main routine `ebayesthresh.wavelet` calls the relevant one of the routines `ebayesthresh.wavelet.wd` (for a transform obtained from WaveThresh), `ebayesthresh.wavelet.dwt` (for transforms obtained from either `dwt` or `modwt` in waveslim) or `ebayesthresh.wavelet.splus` (for transforms obtained from S+WAVELETS.

## Value

The wavelet transform (in the same format as that supplied to the routine) of the values of the estimated regression function underlying the original data.

## Author(s)

Bernard Silverman

## References

Johnstone, I. M. and Silverman, B. W. (2005) Empirical Bayes selection of wavelet thresholds. Annals of Statistics, 33, 1700–1752.

See also the other references given for `ebayesthresh` and at http://www.bernardsilverman.com.

`ebayesthresh`