Compute Maximum Level

DESCRIPTION:
Compute the maximum level in wavelet decomposition, based on sample size, filter length and boundary rule.

USAGE:
max.level(n, L, boundary="periodic", base=2, decimate=T)

REQUIRED ARGUMENTS:
n:
sample size
L:
filter length

OPTIONAL ARGUMENTS:
boundary:
a character string giving the boundary rules, e.g. "periodic", "infinite", "zero". See dwt for a complete list of the available boundary rules.
base:
decimation factor, default base=2.
decimate:
Logical flag, if FALSE, the maximum decomposition level is found for a non-decimate decomposition. If decimate=TRUE, the default, the sample size, filter length and boundary rule determine which algorithm is used. See details below.

VALUE:
a non-negative integer.

DETAILS:
If a non-decimate transform is requested (decimate=F), then max.level is computed as max.level = max( 0, log(n-1/L-1) ) where log is base 2.

Otherwise (decimate=T), if the boundary rule is "periodic", max.level is computed as the largest value of m such that n/2^m is an integer greater than or equal to L.

If the boundary rule is "interval", max.level is computed as the largest value of m such that n/2^m is an integer greater than or equal to 3L-2.

and if any other boundary rule is chosen ("zero", "polynomial", "reflection", or "infinite"), max.level is computed as max.level = max( 0, log(n/L)+1 ) where log is base 2.

For cosine packet analysis, the max.level is computed by max.level(n, 4).


SEE ALSO:
atrous , block.dct , block.cpt , block.dct.2d , block.cpt.2d, cp.costs.2d , cpt , cpt.2d , cp.table , dwt , dwt.2d, nd.dwt , rob.dwt , wp.costs.2d , wpt , wpt.2d , wp.table,