Learn R Programming

wavethresh (version 2.2-11)

wr: Discrete wavelet transform (reconstruction).

Description

This function performs the reconstruction stage of Mallat's pyramid algorithm, i.e., the discrete inverse wavelet transform.

Usage

wr(wd, start.level = 0, verbose = getOption("verbose"),
   bc = wd$bc, return.object = FALSE,
   filter.number = wd$filter$filter.number, family = wd$filter$family)

Arguments

wd
A wavelet decomposition object as returned by wd, see wd.object.
start.level
integer; the level at which to start reconstruction. This is usually the first (level 0).
bc, filter.number, family
by default part of the wd object, but can specified differently by the ``knowing''.
verbose
logical, controlling the printing of ``informative'' messages whilst the computations progress. Such messages are generally annoying so it is turned off by default.
return.object
logical; If this is FALSE then the top level of the reconstruction is returned (this is the reconstructed function at the highest resolution). Otherwise if it is T the whole wd reconstructed object is returned.

Value

  • Either a vector containing the top level reconstruction or an object of class wd containing the results of the reconstruction, details to be found in the documentation for wd.object.

RELEASE

Release 2.2 Copyright Guy Nason 1993

Details

The code implements Mallat's pyramid algorithm (Mallat 1989). In the reconstruction the quadrature mirror filters G and H are supplied with $c_0$ and $d_0, d_1, \dots, d_{m-1}$ (the wavelet coefficients) and rebuild $c_1, \dots, c_m$.

If wd was obtained directly from wd() then the original function can be reconstructued exactly as $c_m$ and can be sought with accessC(wd.object, level=wd.object$levels).

Usually, the wd object has been modified in some way, for example, some coefficients set to zero by threshold. Wr then reconstructs the function with that set of wavelet coefficients.

References

see wd for a list.

See Also

wd, accessC, accessD, filter.select, threshold.

Examples

Run this code
# Decompose and then exactly reconstruct test.data
example(wd)#-> wds has wd() ressult
rec.wds <- wr(wds)
rec.wds.obj <- wr(wds, return.object = TRUE)
rec.wds2 <- accessC(rec.wds.obj, level=rec.wds.obj$nlevels)
all(rec.wds == rec.wds2)# since wr() internally uses accessC()

# Look at accuracy of reconstruction
summary(abs(rec.wds - y)) #~ 10^-11

# Reconstruct a hard.thresholded object, look at the wavelet coefficients
summary(thr.wds <- wr(threshold(wds, type="hard") ))

Run the code above in your browser using DataLab