dwt {wavelets} | R Documentation |
Discrete Wavelet Transform
Description
Computes the discrete wavelet transform coefficients for a univariate or multivariate time series.
Usage
dwt(X, filter="la8", n.levels, boundary="periodic", fast=TRUE)
Arguments
X |
A univariate or multivariate time series. Numeric vectors, matrices and data frames are also accepted. |
filter |
Either a |
n.levels |
An integer specifying the level of the decomposition.
By default this is the value J such that the length of |
boundary |
A character string indicating which boundary method to
use. |
fast |
A logical flag which, if true, indicates that the pyramid algorithm is computed with an internal C function. Otherwise, only R code is used in all computations. |
Details
The discrete wavelet transform is computed via the pyramid
algorithm, using pseudocode written by Percival and Walden (2000),
pp. 100-101. When boundary="periodic"
the resulting wavelet and
scaling coefficients are computed without making changes to the
original series - the pyramid algorithm treats X
as if it is
circular. However, when boundary="reflection"
a call is made to
extend.series
, resulting in a new series which is reflected to
twice the length of the original series. The wavelet and scaling
coefficients are then computed by using a periodic boundary condition
on the reflected sereis, resulting in twice as many wavelet and
scaling coefficients at each level.
Value
Returns an object of class dwt
, which is an S4 object with
slots
W |
A list with element |
V |
A list with element |
filter |
A |
level |
An integer value representing the level of wavelet decomposition. |
n.boundary |
A numeric vector indicating the number of boundary coefficients at each level of the decomposition. |
boundary |
A character string indicating the boundary method used in the decomposition. Valid values are "periodic" or "reflection". |
series |
The original time series, |
class.X |
A character string indicating the class of the input
series. Possible values are |
attr.X |
A list containing the attributes information of the
original time series, |
aligned |
A logical value indicating whether the wavelet and
scaling coefficients have been phase shifted so as to be aligned
with relevant time information from the original series. The value
of this slot is initially FALSE and can only be changed to TRUE via
the |
coe |
A logical value indicating whether the center of energy
method was used in phase alignement of the wavelet and scaling
coefficients. By default, this value is FALSE (and will always be
FALSE when |
Author(s)
Eric Aldrich. ealdrich@gmail.com.
References
Percival, D. B. and A. T. Walden (2000) Wavelet Methods for Time Series Analysis, Cambridge University Press.
See Also
Examples
# obtain the two series listed in Percival and Walden (2000), page 42
X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3)
X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3)
# combine them and compute DWT
newX <- cbind(X1,X2)
wt <- dwt(newX, n.levels=3, boundary="reflection", fast=FALSE)