wd


Wavelet transform (decomposition).

DESCRIPTION

This function can perform two types of discrete wavelet transform (DWT). The standard DWT computes the DWT according to Mallat's pyramidal algorithm (Mallat, 1989). The stationary DWT is related to the standard DWT and in some ways similar to wavelet packets. The actual transform is performed by some C code which is compiled and then dynamically linked into S. Most modern UNIX operating systems can do dynamic linking. S-Plus for Windows now also does it.

USAGE

wd(data, filter.number=2, family="DaubExPhase", type="wavelet", bc="periodic", verbose=F)

REQUIRED ARGUMENTS

data
A vector containing the data you wish to decompose. The length of this vector must be a power of 2.

OPTIONAL ARGUMENTS

filter.number
This selects the smoothness of wavelet that you want to use in the decomposition. By default this is 2, the Daubechies orthonormal compactly supported wavelet N=2 (Daubechies (1988)), extremal phase family.
family
specifies the family of wavelets that you want to use. The options are "DaubExPhase" and "DaubLeAsymm".
type
specifies the type of wavelet transform. This can be "wavelet" (default) in which case the standard DWT is performed (as in previous releases of WaveThresh). If type is "station" then the stationary DWT is performed. At present, only periodic boundary conditions can be used with the stationary wavelet transform.
bc
specifies the boundary handling. If bc=="periodic" the default, then the function you decompose is assumed to be periodic on it's interval of definition, if bc=="symmetric" then the function beyond its boundaries is assumed to be a symmetric reflection of the function in the boundary. The symmetric option was the implicit default in releases prior to 2.2.
verbose
Controls the printing of "informative" messages whilst the computations progress. Such messages are generally annoying so it is turned off by default.

VALUE

An object of class `wd'. Basically, this object is a list with the following components
C
Vector of sets of successively smoothed data. The pyramid structure of Mallat is stacked so that it fits into a vector. The function `accessC' should be used to extract a set for a particular level.
D
Vector of sets of wavelet coefficients at different resolution levels. Again, Mallat's pyramid structure is stacked into a vector. The function `accessD' should be used to extract the coefficients for a particular resolution level.
nlevels
The number of resolution levels. This depends on the length of the data vector. If length(data)=2^m, then there will be m resolution levels. This means there will be m levels of wavelet coefficients (indexed 0,1,2,...,(m-1)), and m+1 levels of smoothed data (indexed 0,1,2,...,m).
fl.dbase
There is more information stored in the C and D than is described above. In the decomposition ``extra'' coefficients are generated that help take care of the boundary effects, this database lists where these start and finish, so the "true" data can be extracted.
filter
A list containing information about the filter type: Contains the string "wavelet" or "station" depending on which type of transform was performed.
date
The date the transform was performed.
bc
How the boundaries were handled.

SIDE EFFECTS

None

DETAILS

If type=="wavelet" then the code implements Mallat's pyramid algorithm (Mallat 1989). Essentially it works like this: you start off with some data cm, which is a real vector of length 2^m, say.

Then from this you obtain two vectors of length 2^(m-1). One of these is a set of smoothed data, c(m-1), say. This looks like a smoothed version of cm. The other is a vector, d(m-1), say. This corresponds to the detail removed in smoothing cm to c(m-1). More precisely, they are the coefficients of the wavelet expansion corresponding to the highest resolution wavelets in the expansion. Similarly, c(m-2) and d(m-2) are obtained from c(m-1), etc. until you reach c0 and d0.

All levels of smoothed data are stacked into a single vector for memory efficiency and ease of transport across the SPlus-C interface.

The smoothing is performed directly by convolution with the wavelet filter (filter.select(n)$H, essentially low- pass filtering), and then dyadic decimation (selecting every other datum, see Vaidyanathan (1990)). The detail extraction is performed by the mirror filter of H, which we call G and is a bandpass filter. G and H are also known quadrature mirror filters.

There are now two methods of handling "boundary problems". If you know that your function is periodic (on it's interval) then use the bc="periodic" option, if you think that the function is symmetric reflection about each boundary then use bc="symmetric". If you don't know then it is wise to experiment with both methods, in any case, if you don't have very much data don't infer too much about your decomposition! If you have loads of data then don't infer too much about the boundaries. It can be easier to interpret the wavelet coefficients from a bc="periodic" decomposition, so that is now the default. Numerical Recipes implements some of the wavelets code, in particular we have compared our code to "wt1" and "daub4" on page 595. We are pleased to announce that our code gives the same answers! The only difference that you might notice is that one of the coefficients, at the beginning or end of the decomposition, always appears in the "wrong" place. This is not so, when you assume periodic boundaries you can imagine the function defined on a circle and you can basically place the coefficient at the beginning or the end (because there is no beginning or end, as it were). (N.b. we have also checked our code against Donoho and Johnstone's TeachWave for Matlab, and again the answers are the same except that our wavelet coefficients are the negative of theirs).

The STATIONARY DWT is very similar to the standard DWT. The stationary DWT contains all circular shifts of the standard DWT. Naively imagine that you do the standard DWT on some data using the Haar wavelets. Coefficients 1 and 2 are added and difference, and also coefficients 3 and 4; 5 and 6 etc. If there is a discontinuity between 1 and 2 then you will pick it up within the transform. If it is between 2 and 3 you will loose it. So it would be nice to do the standard DWT using 2 and 3; 4 and 5 etc. In other words, pick up the data and rotate it by one position and you get another transform. You can do this in one transform that also does more shifts at lower resolution levels. There are a number of points to note about this transform.

It is translation invariant. The standard DWT is O(N) in computational effort the stationary is O(Nlog(N)) and produces Nlog(N) coefficients. The standard DWT is orthogonal, the stationary transform is most definitely not. This has the added disadvantage that stationary wavelet coefficients at all but the finest scale are correlated, even if you supply independet normal noise. This is unlike the standard DWT where the coefficients are independent (normal noise).

RELEASE

Version 3.5.3 Copyright Guy Nason 1994

REFERENCES

Coifman, R.R. and Donoho, D.L. (1995) Translation-Invariant De-Noising. To appear Wavelets and Statistics, Anestis Antoniadis, ed. Springer-Verlag Lecture Notes, 1995.

Daubechies, I. (1988) Orthonormal bases of compactly supported wavelets Communications on Pure and Applied Mathematics, Vol. 41, 909-996

CML TR95-03, Lang, M., Guo, H., Odegard, J.E., Burrus, C.S. and R. O. Wells, Jr., Nonlinear Processing of a Shift Invariant DWT for Noise Reduction, accepted for the Proceeding of SPIE, Mathematical Imaging: Wavelet Application for Dual Use, in SPIE Symposium on OE/Aerospace Sensing and Dual Use Photonics, 17-21 April 1995, Orlando, FL.

Mallat, S. G. (1989) A theory for multiresolution signal decomposition: the wavelet representation IEEE Transactions on Pattern Analysis and Machine Intelligence. Vol. 11, Number 7 674-693.

Nason, G. P. and Silverman, B. W. (1994). The discrete wavelet transform in S. Journal of Computational and Graphical Statistics, Vol. 3, 163-191.

Nason, G. P. and Silverman, B.W. (1995). The Stationary Wavelet Transform and some statistical applications. February 1995, Technical Report, Department of Mathematics, University of Bristol.

Shensa, M.J. (1992) The discrete wavelet transform - wedding the a trous and Mallat algorithms IEEE Transactions on Signal Processing. Vol. 40 Number 10 2464-2482.

Vaidyanathan, P. P. (1990) Multirate digital filters, filter banks, polyphase networks and applications: a tutorial. Proceedings of the IEEE, Vol. 78, Number 1, 56-93

SEE ALSO

`wr', `accessC', `accessD',`filter.select', `plot', `dyn.load' `threshold'

EXAMPLES

#
# Generate some test data
#
> test.data <- example.1()$y
> tsplot(y)

#
# Decompose test.data and plot the wavelet coefficients
#
> wds <- wd(test.data)
> plot(wds)

#
# Now do the stationary wavelet transform of the same thing
#
> wdS <- wd(test.data, type="station")
> plot(wdS)


G.P.Nason@bristol.ac.uk