Cosine Packet Table

DESCRIPTION:

Computes cosine packet (local cosine) table.

USAGE:

cp.table(x, cost.fun="entropy", n.levels=6, taper="poly2", 
         dct.type=2, boundary="periodic", n.taper=NULL, 
         scale=NULL, thresh=NULL, p=2, prob=.5) 
as.ptable(x) 

REQUIRED ARGUMENTS:

x
a vector or univariate time series, or, for as.ptable only, an object of ptable, cpt, cp.molecule. When x is a vector or univariate time series, the length of x should be divisible by 2^n.levels and should demean first.

OPTIONAL ARGUMENTS:

cost.fun
character string indicating which cost functional to use: "entropy", "threshold", "sure", and " lp" are available. See pcosts for details.
n.levels
a non-negative integer specifying the blocking factor at the finest level in the cosine packet table: at the finest level, x is divided into 2^n.levels blocks each of length length(x)/2^n.levels. If n.levels is bigger than ml, where ml is the maximum possible level, computed from the max.level function, then n.levels is set to ml and a warning message is given.
dct.type
one of 2 or 4 indicating which of DCT-II or DCT-IV should be used. See the function dct for details.
taper
a character string, indicating the taper function: "boxcar", "poly1", "poly2", "poly3", "poly4", "poly5", or "trig". See details below for the definitions of these tapers.
boundary
a character string, available boundary rules: "cp.reflect", "periodic" and "zero". See details below for the definitions of these rules.
n.taper
a non-negative integer. The length of the taper will be 2*n.taper. By default, n.taper is set to length(x)/2^(n.level+1), which is the maximum possible length at the finest blocking level.
scale
scaling factor for computing the costs. The default depends on cost.fun. See pcosts for details.
p
a number in the interval (0,2] giving the degree of the lpnorm when cost.fun is "lp". See pcosts for details.
thresh
a non-negative number giving the threshold for when cost.fun is "threshold" or "sure". See pcosts for details.
prob
a number in the interval (0,1) used to compute the threshold for when cost.fun is "threshold". See pcosts for details.

VALUE:

a cosine packet table as a numeric vector of cosine packet coefficients ranging from levels 0 to n.levels. The attribute pcosts is a numeric vector of length 2^(n.levels+1)-1 of "costs" based on cost.fun. Additional information about the transform is stored in attribute dictionary. The returned cosine packet table has class ptable, inheriting from classes cp, and crystal.vector. See crystal.vector.object for details about the data structure. as.ptable returns x, if x is an object of ptable or cpt.

DETAILS:

A cosine packet table is a redundant non-invertible transform of the data. Invertible orthogonal transforms can be selected from a packet table using the best.basis function and the Subscript operators. The jth level of a cosine packet table is equivalent to result from the block.cpt function with n.levels=j. A cosine packet crystal corresonds to the DCT applied to a tapered block of the original signal. Overall, a cosine packet table contains 2^(n.levels+1)-1 cosine packet crystals. Each crystal has a crystal.name of the form cj.b where j is the level and b is the block within level. You can subscript an entire level of a cosine packet table, or you can subscript sets of crystals either by position or name. Available tapers:

boxcar

the taper is a discontinuous "boxcar" function, and is equivalent to no tapering on the block.

poly1-poly5
these tapers are smooth polynomial tapers. The taper poly1 has one continuous derivative. The tapers poly2 to poly5 have two to five continuous derivatives respectively.
trig
a smooth taper based on trigonometic functions which is infinitely differentiable.

Available boundary rules:
cp.reflect

the series is reflected (and then periodically extended). For perfect reconstruction, symmetric/antisymmetric wavelets are needed.

periodic
the original series is assumed to be periodic. Sample size must be divisible by 2^(n.levels).
zero
at each level, the series is padded using zeros.

See the chapter on "Cosine Packet Analysis" of S+WAVELETS User's Manual for more details about cp.table and cosine packet analysis. The default optional arguments n.levels, taper, dct.type, boundary can be reset using function wavelet.options, see wavelet.options for details.

REFERENCES:

Coifman, R., Meyer, Y., Quake, S. and Wickerhauser, M. V. (1990). Signal processing and compression with wavelet packets. Technical report, Yale University.

Coifman, R. and Wickerhauser, V. (1992). Entropy-based algorithms for best basis selection. IEEE Transactions on Information Theory Vol. 38(2), pages 713-718.

Wickerhauser, M. V. (1994). Adapted Wavelet Analysis from Theory to Software. A. K. Peters Ltd, Wellesley, MA.

SEE ALSO:

, , , , , , , .

EXAMPLES:

xx <- make.signal("linchirp", 512) 
yc <- cp.table(xx, taper="trig", n.levels=4) 
eda.plot(yc)