Learn R Programming

wmtsa (version 2.0-3)

wavDWT: The discrete wavelet transform (DWT)

Description

The discrete wavelet transform using convolution style filtering and periodic extension.

Let \(j, t\) be the decomposition level, and time index, respectively, and \(s_{0,t}=X_{t=0}^{N-1}\) where \(X_t\) is a real-valued uniformly-sampled time series. The \(j^{th}\) level DWT wavelet coefficients (\(d_{j,t}\)) and scaling coefficients (\(s_{j,t}\)) are defined as \(d_{j,t} \equiv \sum_{l=0}^{L-1} h_l s_{j-1,2t+1-l \bmod N_{j-1}}, \quad t=0,\ldots, N_j -1\) and \(s_{j,t} \equiv \sum_{l=0}^{L-1} g_l s_{j-1,2t+1-l \bmod N_{j-1}}, \quad t=0,\ldots, N_j -1\) for \(j=1,\ldots,J\) where \(\{ h_l \}\) and \(\{ g_l \}\) are the \(j^{th}\) level wavelet and scaling filter, respectively, and \(N_j \equiv N / 2^j\). The DWT is a collection of all wavelet coefficients and the scaling coefficients at the last level: \(\mathbf{d_1,d_2},\ldots,\mathbf{d_J,s_J}\) where \(\mathbf{d_j}\) and \(\mathbf{s_j}\) denote a collection of wavelet and scaling coefficients, respectively, at level \(j\).

Usage

wavDWT(x, n.levels=ilogb(length(x), base=2),
    wavelet="s8", position=list(from=1,by=1,units=character()), units=character(),
    title.data=character(), documentation=character(), keep.series=FALSE)

Arguments

x

a vector containing a uniformly-sampled real-valued time series.

documentation

a character string used to describe the input data. Default: character().

keep.series

a logical value. If TRUE, the original series is preserved in the output object. Default: FALSE.

n.levels

the number of decomposition levels. Default: as.integer(floor(logb(length(x),base=2))).

position

a list containing the arguments from, by and to which describe the position(s) of the input data. All position arguments need not be specified as missing members will be filled in by their default values. Default: list(from=1, by=1, units=character()).

title.data

a character string representing the name of the input data. Default: character().

units

a string denoting the units of the time series. Default: character() (no units).

wavelet

a character string denoting the filter type. See wavDaubechies for details. Default: "s8".

Value

an object of class wavTransform.

Details

This DWT imposes an ad hoc storage sytem for odd length scaling coefficient crystals: if the length of a scaling coefficient crystal is odd, the last coefficient is "stored" in the extra crystal. During reconstruction, any extra scaling coefficients are returned to their proper location. Such as system imposes no spurious energy in the transform coefficients at the cost of a little bookkeeping.

References

D. B. Percival and A. T. Walden, Wavelet Methods for Time Series Analysis, Cambridge University Press, 2000.

See Also

reconstruct, wavDaubechies, wavMODWT, wavMODWPT, wavMRD, wavDictionary, wavIndex, wavTitle, wavBoundary, wavShrink.

Examples

Run this code
# NOT RUN {
## calculate the DWT of linear chirp 
linchirp <- make.signal("linchirp", n=1024)
result   <- wavDWT(linchirp, wavelet="s8", n.levels=5, keep.series=TRUE)

## plot the transform shifted for approximate zero 
## phase alignment 
plot(wavShift(result))

## plot summary 
eda.plot(result)

## summarize the transform 
summary(result)
# }

Run the code above in your browser using DataLab