DWPT Best basis selection
Description
The discrete wavelet packet transform (DWPT) contains a multitude of disjoint dyadic decompositions representing an ensemble of different bases. Best basis selection is an attempt to isloate one such basis in an optimal way.
Usage
1  wavBestBasis(costs)

Arguments
costs 
a numeric vector containing the costs for each crystal in a DWPT in C(W(0,0)), C(W(1,0)), C(W(1,1)), C(W(2,0)), ..., C(W(J,2^J1)) order where C() is the additive cost functional and W(j,n) is the DWPT crystal at level j and oscillation (local node) index n for j=1,...,J. 
References
Ronald R. Coifman and Mladen Victor Wickerhauser, “EntropyBased Algorithms for Best Basis Selection", IEEE Transactions on Information Theory, 38(2), pp. 713–718, 1992.
D. B. Percival and A. T. Walden, Wavelet Methods for Time Series Analysis, Cambridge University Press, 2000.
See Also
wavDWPT
.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  ## calculate the DWPT of the difference of the
## atomic clock series
W < wavDWPT(diff(atomclock), n.level=6)
## define an entropy cost functional
"entropy" < function(x){
iz < which(x==0)
z < x^2 * log(x^2)
if (length(iz))
z[iz] < 0
sum(z)
}
## create the cost vector
C < unlist(lapply(W$data, entropy))
## calculate the bets basis
z < wavBestBasis(C)
## print the crystals of the best basis
paste("W(", z$level, ",", z$osc, ")", sep="")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.