numtonv              package:wavethresh              R Documentation

_C_o_n_v_e_r_t _a_n _i_n_d_e_x _n_u_m_b_e_r _i_n_t_o _a _n_o_d_e _v_e_c_t_o_r _o_b_j_e_c_t.

_D_e_s_c_r_i_p_t_i_o_n:

     Convert an index number into a 'node vector' object.

_U_s_a_g_e:

     numtonv(number, nlevels)

_A_r_g_u_m_e_n_t_s:

  number: The index number of a particular basis within a wavelet
          object.

 nlevels: The number of levels that the wavelet object has (can often
          be discovered using the 'nlevels' function). 

_D_e_t_a_i_l_s:

     A basis within a (e.g. non-decimated) wavelet object (such as a
     'wst.object') is represented in WaveThresh by a 'nv' or node
     vector. 

     A packet-ordered non-decimated wavelet transform object 'wst' for
     short) which is the transform of a vector of length 'n' contains
     'n' bases. Each basis can be indexed from 0 to '(n-1)' . 

     A 'wst.object' is simply a fully populated binary tree. There are
     nlevels levels in the tree with a split at each level. The root of
     the tree is at level 0, there are two branches at level 1, four at
     level 2, eight at level 3 and so on. A path through the tree can
     be constructed by starting at the root and choosing "left" or
     "right" at each possible branch. For certain data situations this
     path is constructed using minimum entropy algorithms (for example
     'MaNoVe'). This function (numtonv takes the numerical
     representation of a path and converts it into a 'node.vector' form
     suitable for passing to 'InvBasis' to invert the representation
     according to a basis specicified by number.

     The least significant digit in number corresponds to deciding on
     the left/right decision at the fine leaves of the tree
     (high-frequency structure) and the most significant digit in
     number corresponds to deciding on the left/right decision at the
     root. Therefore gradually incrementing number from 0 to
     (2^'nlevels')-1 steps through all possible bases in the 'wst'
     object ranging from all decisions being made "left" to all
     decisions being made "right". The "number" dividied by
     (2^'nlevels') corresponds exactly to the binary number epsilon in
     Nason and Silverman (1995).

_V_a_l_u_e:

     An object of class 'nv' (node vector). This contains information
     about a path through a wavelet object (a basis in a wavelet
     object).

_R_E_L_E_A_S_E:

     Version 3.6.0 Copyright Guy Nason 1995

_S_e_e _A_l_s_o:

     'wst', 'wst.object', 'MaNoVe', 'nv.object', 'InvBasis', 'nlevels'.

_E_x_a_m_p_l_e_s:

     #
     # Generate some test data
     #
     #test.data <- example.1()$y
     #
     # Make it noisy
     #
     #ynoise <- test.data + rnorm(512, sd=0.1)
     #
     # Do packet ordered non-decimated wavelet transform
     #
     #ynwst <- wst(ynoise)
     #
     # Now threshold the coefficients
     #
     #ynwstT <- threshold(ynwst)
     #
     # Select basis number 9 (why not?)
     #
     #NodeVector9 <- numtonv(9, nlevels(ynwstT))
     #
     # Let's print it out to see what it looks like
     # (nb, if you're repeating this example, the basis might be different
     # as you may have generated different pseudo random noise to me)
     #
     #NodeVector9
     # Level :  8  Action is  R (getpacket Index:  1 )
     # Level :  7  Action is  L (getpacket Index:  2 )
     # Level :  6  Action is  L (getpacket Index:  4 )
     # Level :  5  Action is  R (getpacket Index:  9 )
     # Level :  4  Action is  L (getpacket Index:  18 )
     # Level :  3  Action is  L (getpacket Index:  36 )
     # Level :  2  Action is  L (getpacket Index:  72 )
     # Level :  1  Action is  L (getpacket Index:  144 )
     # Level :  0  Action is  L (getpacket Index:  288 )
     # There are  9  reconstruction steps
     #
     # The print-out describes the tree through ynwstT that corresponds to
     # basis 9.
     #
     # The NodeVector9 and ynwstT objects could now be supplied to
     # InvBasis.wst for inverting ynwstT according
     # to the NodeVector9 or basis number 9.

