This function is generic (see Methods); method functions can be written to handle specific classes of data. Classes which already have methods for this function include: pcosts, pcosts.2d, ptable.
best.basis(x, type="wp", J=NULL, costs=attr(x, "pcosts"), data=NULL, ...)
Otherwise, a wavelet packet transform object or a cosine packet transform object is returned. 1-D wavelet packet transforms have class wpt inheriting from classes wp and crystal.vector (if boundary is not infinite) or crystal.list (if boundary=infinite). 1-D cosine packet transforms have class cpt inheriting from classes cp and crystal.vector. See crystal.vector.object and crystal.list.object for details.
2-D wavelet packet and cosine packet transforms have class wpt.2d and cpt.2d, and inherit from class crystal.matrix. See crystal.matrix.object for details.
If x is a numeric vector or univariate time series, then best.basis will first compute a wavelet packet or cosine packet table (according to type="wp" or "cp) and then select the best basis from the table.
If x is a matrix or an image, then best.basis will first compute a 2D wavelet or cosine packet cost vector (according to type="wp" or "cp) and then select the best basis from the cost vector.
For more details, refer to the section "The Best Basis Algorithm" of the S+WAVELETS User's Manual for details. See also Coifman and Wickerhauser (1992) and Chapter 8 of Wickerhauser (1994).
Wickerhauser, M. V. (1994). Adapted Wavelet Analysis -- from theory to software.
yy <- make.signal("linchirp", 512) # a linear chirp yw <- wp.table(yy, wavelet="s8", n.levels=4) bb <- best.basis(yw) # select the best basis eda.plot(bb)yc <- cp.table(yy, taper="trig", n.levels=4) bc <- best.basis(yc) eda.plot(bc)
x <- phone-mean(phone) wcost <- wp.costs.2d(x, wavelet="s8", n.levels=3) bb2 <- best.basis(wcost, x) eda.plot(bb2)
ccost <- cp.costs.2d(x, taper="poly1", n.levels=3) bb3 <- best.basis(ccost, x) eda.plot(bb3)