pcosts, pcosts.2d, ptable.
best.basis(x, type="wp", J=NULL, costs=attr(x, "pcosts"), data=NULL, ...)
pcosts, pcosts.2d, wp.table, cp.table,wp.table.list or cp.table.list.
"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
wp.table
,
cp.table
,
wp.table.list
,
cp.table.list
,
pcosts
or
pcosts.2d
.
x
is an object of
ptable
or
pcosts
.
Levels beyond
J
will be ignored in the best basis
selection process.
The default is
n.levels
.
2^min(J, n.level)
.
The best basis will be selected based on
the costs vector.
This argument applies only for when
x
is an object of
ptable
.
The vector
costs
is typically created by
pcosts
applied to a
ptable
object.
x
is a
pcosts.2d
object.
If present, coefficients of the best basis are returned
(a matrix of the same size as
data
), otherwise, a character vector of
crystal.names
representing the best basis is returned.
wp.table
or
cp.table
when
x
is a numeric
vector; additional arguments for
wp.costs.2d
or
cp.costs.2d
when
x
is a matrix. See
wp.table, cp.table, wp.costs.2d, cp.costs.2d
for details.
x
is an object of
pcosts
or an object of
pcosts.2d
and
data
is not
provided, a character vector of
crystal.names
is returned.
See
pcosts.object
and
pcosts.2d.object
for details.
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
wp.list
and
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.
The best basis algorithm was developed by
Coifman and Wickerhauser (1992)
and is used to select "optimal" bases (i.e., transforms)
from wavelet packet and cosine packet tables.
The best basis algorithm finds the wavelet packet or cosine packet
transform W
which minimizes an additive cost function E.
See
pcosts
for the available cost functions.
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).
Yale University has applied for a patent
for the
best basis
algorithm.
Anyone using the
best basis
algorithm
for commercial applications should contact
Yale University regarding the licensing of its use.
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. A. K. Peters Ltd, Wellesley, MA.
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)