makegrid             package:wavethresh             R Documentation

_I_n_t_e_r_p_o_l_a_t_e _d_a_t_a _t_o _a _g_r_i_d.

_D_e_s_c_r_i_p_t_i_o_n:

     This function takes a set of univariate (x,y) data with x
     arbitrary in (0,1) and linearly interpolates (x,y) to an equally
     spaced dyadic grid.

_U_s_a_g_e:

     makegrid(t, y, gridn = 2^(floor(log(length(t)-1,2)) + 1))

_A_r_g_u_m_e_n_t_s:

       t: A vector of 'x' data. Each of the entries of 'x' must lie
          between 0 and 1.

       y: A vector of 'y' data. Each entry of 'y' corresponds to the
          same-positioned entry in 'x' and so'y' must be of the same
          length as 'x'. 

   gridn: The number of grid points in the dyadic grid that the (x,y)
          gets interpolated to. By default this is the next power of
          two larger than the length of {x}.

_D_e_t_a_i_l_s:

     One method for performing wavelet regression on data that is not
     equally spaced nor of power of two length is that described in
     Kovac, (1997) and Kovac and Silverman, (2000). 

     The Kovac-Silverman algorithm linearly interpolates arbitrarily
     spaced (x,y) data to a dyadic grid and applies wavelet shrinkage
     to the interpolated data. However, if one assumes that the
     original data obeys a signal+noise model with iid data the
     interpolated data will be correlated due to the interpolation.
     This fact needs to be taken into account after taking the DWT and
     before thresholding one realizes that each coefficient has its own
     variance. The Kovac-Silverman algorithm computes this variance
     efficiently using knowledge of the interpolation scheme.

_V_a_l_u_e:

     An object of class 'griddata'.

_R_E_L_E_A_S_E:

     Version 3.9.6 Copyright Arne Kovac 1997 Copyright Guy Nason (help
     pages) 1999

_S_e_e _A_l_s_o:

     'accessc', 'doppler', 'irregwd', 'newsure', 'plot.irregwd',
     'threshold.irregwd',

_E_x_a_m_p_l_e_s:

     #
     # Generate some values in (0,1), then sort them (for plotting)
     #
     #tt <- sort(runif(100))
     #
     # Now evaluate the this-is-escaped-codenormal-bracket40bracket-normal function and add
     # some noise.
     #
     #yy <- doppler(tt) + rnorm(100, 0, 0.15)
     #
     # Now make the grid with this data
     #
     #yygrid <- makegrid(t=tt, y=yy)
     #
     # Jolly good. Now let's take the wavelet transform of this gridded data.
     # Note that we have to use the this-is-escaped-codenormal-bracket42bracket-normal function
     # of the gridded data as it computes the variances of the coefficients
     # as well as the coefficients themselves.
     #
     #yyirregwd <- irregwd(yygrid)
     #
     # You might want to plot the coefficients
     #
     # If you want to see the actual coefficients you have to first convert
     # the class of the yyirregwd object to a wd object and then use
     # this-is-escaped-codenormal-bracket44bracket-normal like this
     #
     #yyirregwd2 <- yyirregwd
     #class(yyirregwd2) <- "wd"
     #plot(yyirregwd2)
     #
     # If you want to see the variance factors (essentially the coefficient
     # variances divided by the overall variance). Then just use
     # this-is-escaped-codenormal-bracket46bracket-normal
     #
     #plot(yyirregwd)
     #
     # Ok. So you've seen the coefficients. Now let's do some thresholding.
     #
     #yy.thresh.sure <- threshold(yyirregwd, policy="sure", type="soft", dev=madmad)
     #
     # And now do the reconstruct
     #
     #yy.wr <- wr(yy.thresh.sure)
     #
     # And you can even plot the answer on the new grid!
     #
     #plot(yygrid$gridt, yy.wr, type="l")
     #
     # And superimpose the original data!
     #
     #points(tt, yy)
     #
     # This is sort of this-is-escaped-codenormal-bracket48bracket-normal like!

