putC.mwd             package:wavethresh             R Documentation

_P_u_t _s_m_o_o_t_h_e_d _d_a_t_a _i_n_t_o _w_a_v_e_l_e_t _s_t_r_u_c_t_u_r_e

_D_e_s_c_r_i_p_t_i_o_n:

     The smoothed and original data from a multiple wavelet
     decomposition structure, 'mwd.object', (e.g. returned from 'mwd')
     are packed into a single matrix in that structure. This function
     copies the 'mwd.object', replaces some smoothed data in the copy,
     and then returns the copy.

_U_s_a_g_e:

     putC.mwd(mwd, level, M, boundary = FALSE, index = FALSE, ...)

_A_r_g_u_m_e_n_t_s:

     mwd: Multiple wavelet decomposition structure whose coefficients
          you wish to replace.

   level: The level that you wish to replace.

       M: Matrix of replacement coefficients.

boundary: If 'boundary' is 'FALSE' then only the "real" data is
          replaced (and it is easy to predict the required length of
          'M'). If boundary is TRUE then you can replace the boundary
          values at a particular level as well (but it is hard to
          predict the required length of 'M', and the information has
          to be obtained from the 'mfirst.last' database component of
          'mwd').

   index: If index is 'TRUE' then the index numbers into the 'mwd$C'
          array where the matrix 'M' would be stored is returned.
          Otherwise, (default) the modified 'mwd.object' is returned.

     ...: any other arguments

_D_e_t_a_i_l_s:

     The 'mwd' function produces a wavelet decomposition structure. 

     The need for this function is a consequence of the pyramidal
     structure of Mallat's algorithm and the memory efficiency gain
     achieved by storing the pyramid as a linear matrix of
     coefficients. PutC obtains information about where the smoothed
     data appears from the fl.dbase component of mwd, in particular the
     array 'fl.dbase$first.last.c' which gives a complete specification
     of index numbers and offsets for 'mwd$C'. 

     Note also that this function only _puts_ information into 'mwd'
     class objects. To _extract_ coefficients from 'mwd' structures you
     have to use the 'accessC.mwd' function. 

     See Downie and Silverman, 1998.

_V_a_l_u_e:

     An object of class 'mwd.object' if 'index' is 'FALSE', otherwise
     the index numbers indicating where the 'M' matrix would have been
     inserted into the 'mwd$C' object are returned.

_R_E_L_E_A_S_E:

     Version 3.9.6 (Although Copyright Tim Downie 1995-6).

_S_e_e _A_l_s_o:

     'accessC.mwd', 'accessD.mwd', 'draw.mwd', 'mfirst.last',
     'mfilter.select', 'mwd', 'mwd.object', 'mwr', 'plot.mwd',
     'print.mwd', 'putD.mwd', 'summary.mwd', 'threshold.mwd', 'wd',
     'wr.mwd'.

_E_x_a_m_p_l_e_s:

     #
     # Generate an mwd object
     #
     #tmp <- mwd(rnorm(32))
     #
     # Now let's examine the finest resolution smooth...
     #
     #accessC(tmp, level=3)
     #           [,1]       [,2]       [,3]       [,4]        [,5]      [,6] 
     #[1,] -0.4669103 -1.3150580 -0.7094966 -0.1979214  0.32079986 0.5052254
     #[2,] -0.7645379 -0.8680941  0.1004062  0.6633268 -0.05860848 0.5757286
     #          [,7]       [,8] 
     #[1,] 0.5187380  0.6533843
     #[2,] 0.2864293 -0.4433788
     #
     # A matrix. There are two rows one for each father wavelet in this 
     # two-ple multiple wavelet transform and at level 3 there are 2^3 columns.
     #
     # Let's set the coefficients of the first father wavelet all equal to zero
     # for this example
     #
     #newcmat <- accessC(tmp, level=3)
     #newcmat[1,] <- 0
     #
     # Ok, let's insert it back at level 3
     #
     #tmp2 <- putC(tmp, level=3, M=newcmat)
     #
     # And check it
     #
     #accessC(tmp2, level=3)   
     #           [,1]       [,2]      [,3]      [,4]        [,5]      [,6]      [,7] 
     #[1,]  0.0000000  0.0000000 0.0000000 0.0000000  0.00000000 0.0000000 0.0000000
     #[2,] -0.7645379 -0.8680941 0.1004062 0.6633268 -0.05860848 0.5757286 0.2864293
     #           [,8] 
     #[1,]  0.0000000
     #[2,] -0.4433788
     #
     # Yep, all the first father wavelet coefficients at level 3 are now zero.

