Select Best Level

DESCRIPTION:
Selects the best level from a wavelet packet table or cosine packet table based on given cost functional.

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, ptable.


USAGE:
best.level(x, type="wp", J=NULL, costs=attr(x, "pcosts"), ...)

REQUIRED ARGUMENTS:
x:
a numeric vector, a univariate time series, or an object of pcosts or ptable.

OPTIONAL ARGUMENTS:
type:
one of the character strings "wp" or "cp" indicating whether to perform wavelet packet analysis or cosine packet analysis. This argument will be ignored when x is an object of pcosts or ptable.
J:
maximum depth of tree-search. In effect only when x is an object of ptable or pcosts. Levels beyond J will be ignored in the best level selection process.
costs:
for x is a ptable object only. The best level will be selected based on the costs vector.
...:
additional arguments for wp.table or cp.table when x is a numeric vector. See wp.table, cp.table for details.

VALUE:
when x is an object of pcosts, a character vector of crystal.names is returned; otherwise, an object of class wpt or cpt, inheriting from class wp or cp. It also inherits from class crystal.vector or crystal.list, depending on the way the basis is stored.

DETAILS:
If x is a numeric vector or univariate time series, then best.level will first compute a wavelet packet or cosine packet table (according to type="wp" or "cp) and then select the best level from the table.

The outcome of best.basis is the orthogonal basis, which minimizes the sum of the costs over all possible orthogonal basis choices up to level J.

See the chapter "Wavelet Packet Analysis" of the S+WAVELETS User's Manual for details. The algorithm can also be found in pp.717 of Coifman and Wickerhauser (1992) and Chapter 8 of Wickerhauser (1994).


REFERENCES:
Coifman, R. and Wickerhauser, M. V. (1992). Entropy-Based Algorithms for Best Basis Selection. IEEE Transactions on Information Theory, 38 (2): 713-718.

Wickerhauser, M. V. (1994). Adapted Wavelet Analysis -- from theory to software.


SEE ALSO:
best.basis , cp.table , pcosts , pcosts.object , wp.table .

EXAMPLES:
yy <- make.signal("linchirp", 512)    # a linear chirp
yw <- wp.table(yy, wavelet="s8", n.levels=3)
bl <- best.level(yw)                  # select the best level
eda.plot(bl)

yc <- cp.table(yy, taper="trig", n.levels=3) bc <- best.level(yc) eda.plot(bc)