getpacket.wp           package:wavethresh           R Documentation

_G_e_t _p_a_c_k_e_t _o_f _c_o_e_f_f_i_c_i_e_n_t_s _f_r_o_m _a _w_a_v_e_l_e_t _p_a_c_k_e_t _o_b_j_e_c_t (_w_p).

_D_e_s_c_r_i_p_t_i_o_n:

     This function extracts and returns a packet of coefficients from a
     wavelet packet ('wp') object.

_U_s_a_g_e:

     getpacket.wp(wp, level, index, ... )

_A_r_g_u_m_e_n_t_s:

      wp: Wavelet packet object from which you wish to extract the
          packet from.

   level: The resolution level of the coefficients that you wish to
          extract.

   index: The index number within the resolution level of the packet of
          coefficients that you wish to extract.

     ...: any other arguments

_D_e_t_a_i_l_s:

     The 'wp' produces a wavelet packet object. The coefficients in
     this structure can be organised into a binary tree with each node
     in the tree containing a packet of coefficients. 

     Each packet of coefficients is obtained by chaining together the
     effect of the _two packet operators_ DG and DH: these are the high
     and low pass quadrature mirror filters of the Mallat pyramid
     algorithm scheme followed by decimation (see Mallat~(1989b)). 

     Starting with data c^J at resolution level J containing 2^J data
     points the wavelet packet algorithm operates as follows. First DG
     and DH are applied to c^J producing d^{J-1} and c^{J-1}
     respectively. Each of these sets of coefficients is of length one
     half of the original data: i.e. 2^{J-1}. Each of these sets of
     coefficients is a set of _wavelet packet coefficients_. The
     algorithm then applies both DG and DH to both d^{J-1} and c^{J-1}
     to form a four sets of coefficients at level J-2. Both operators
     are used again on the four sets to produce 8 sets, then again on
     the 8 sets to form 16 sets and so on. At level j=J,...,0 there are
     2^{J-j} packets of coefficients each containing 2^j coefficients. 

     This function enables whole packets of coefficients to be
     extracted at any resolution level. The index argument chooses a
     particular packet within each level and thus ranges from 0 (which
     always refer to the father wavelet coefficients), 1 (which always
     refer to the mother wavelet coefficients) up to 2^{J-j}.

_V_a_l_u_e:

     A vector containing the packet of wavelet packet coefficients that
     you wished to extract.

_R_E_L_E_A_S_E:

     Version 3.9 Copyright Guy Nason 1998

_S_e_e _A_l_s_o:

     'wp', 'putpacket.wp', 'basisplot.wp', 'draw.wp', 'InvBasis.wp',
     'MaNoVe.wp', 'nlevels.wp', 'plot.wp'. 'threshold.wp'.

_E_x_a_m_p_l_e_s:

     #
     # Take the wavelet packet transform of some random data
     #
     #MyWP <- wp(rnorm(1:512))
     #
     # The above data set was 2^9 in length. Therefore there are
     # coefficients at resolution levels 0, 1, 2, ..., and 8.
     #
     # The high resolution coefficients are at level 8.
     # There should be 256 DG coefficients and 256 DH coefficients
     #
     #length(getpacket(MyWP, level=8, index=0))
     #[1] 256
     #length(getpacket(MyWP, level=8, index=1))
     #[1] 256
     #
     # The next command shows that there are only two packets at level 8
     #
     #getpacket(MyWP, level=8, index=2)
     #Index was too high, maximum for this level is  1 
     #Error in getpacket.wp(MyWP, level = 8, index = 2): Error occured
     #Dumped
     #
     # There should be 4 coefficients at resolution level 2
     #
     # The father wavelet coefficients are (index=0)
     #getpacket(MyWP, level=2, index=0)
     #[1] -0.9736576  0.5579501  0.3100629 -0.3834068
     #
     # The mother wavelet coefficients are (index=1)
     #
     #[1]  0.72871405  0.04356728 -0.43175307  1.77291483
     #
     # There will be 127 packets at this level.
     #

