dwt                 package:wavelets                 R Documentation

_D_i_s_c_r_e_t_e _W_a_v_e_l_e_t _T_r_a_n_s_f_o_r_m

_D_e_s_c_r_i_p_t_i_o_n:

     Computes the discrete wavelet transform coefficients for a
     univariate or multivariate time series.

_U_s_a_g_e:

     dwt(X, filter="la8", n.levels, boundary="periodic", fast=TRUE)

_A_r_g_u_m_e_n_t_s:

       X: A univariate or multivariate time series. Numeric vectors,
          matrices and data frames are also accepted.

  filter: Either a 'wt.filter' object, a character string indicating
          which wavelet filter to use in the decomposition, or a
          numeric vector of wavelet coefficients (not scaling
          coefficients). See 'help(wt.filter)' for acceptable filter
          names.

n.levels: An integer specifying the level of the decomposition. By
          default this is the value J such that the length of X is at
          least as great as the length of the level J wavelet filter,
          but less than the length of the level J+1 wavelet filter.
          Thus, j <= log((N-1)/(L-1)+1), where N is the length of X.

boundary: A character string indicating which boundary method to use.
          'boundary = "periodic"' and 'boundary = "reflection"' are the
          only supported methods at this time.

    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.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     Returns an object of class 'dwt', which is an S4 object with slots       

       W: A list with element i comprised of a matrix containing the
          ith level wavelet coefficients.

       V: A list with element i comprised of a matrix containing the
          ith level scaling coefficients.

  filter: A 'wt.filter' object containing information for the filter
          used in the decomposition. See 'help(wt.filter)' for details.

   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, 'X', in matrix format.

 class.X: A character string indicating the class of the input series. 
          Possible values are '"ts"', '"mts"', '"numeric"', '"matrix"',
          or '"data.frame"'.

  attr.X: A list containing the attributes information of the original
          time series, 'X'.  This is useful if 'X' is an object of
          class 'ts' or 'mts' and it is desired to retain relevant time
          information. If the original time series, 'X', is a matrix or
          has no attributes, then 'attr.X' is an empty list.

 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 'align' function, with the 'dwt' object as
          input.

     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 'aligned' is FALSE) and will be set
          to true if the 'dwt' object is phase shifted via the 'align'
          function and center of energy method.

_A_u_t_h_o_r(_s):

     Eric Aldrich. ealdrich@gmail.com.

_R_e_f_e_r_e_n_c_e_s:

     Percival, D. B. and A. T. Walden (2000) _Wavelet Methods for Time
     Series Analysis_, Cambridge University Press.

_S_e_e _A_l_s_o:

     'modwt', 'wt.filter'.

_E_x_a_m_p_l_e_s:

     # 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)

