Given a time series of length N, I am trying to figure out its maximum DWT decomposition level.
With reference to "dwt" function of R package "wavelets", running the provided example I get the following
and wonder how the maximum decomposition level (which is not an integer number) is calculated.

I tried myself the formula in the on-line documentation but could not get the printed threshold in the error
message.

 > X1 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,.7,.9,0,.3)
> X2 <- c(.2,-.4,-.6,-.5,-.8,-.4,-.9,0,-.2,.1,-.1,.1,-.7,.9,0,.3)
> newX <- cbind(X1,X2)
> wt <- dwt(newX, n.levels=5, boundary="periodic", fast=FALSE)
> wt <- dwt(newX,filter="la8",n.levels=6, boundary="periodic", fast=FALSE)
Error in dwt(newX, filter = "la8", n.levels = 6, boundary = "periodic",  :
  Invalid argument value: 'n.levels' cannot be greater than 5
> newX <- newX[-32]
> wt <- dwt(newX,filter="la8",n.levels=5, boundary="periodic", fast=FALSE)
Error in dwt(newX, filter = "la8", n.levels = 5, boundary = "periodic",  :
  Invalid argument value: 'n.levels' cannot be greater than 4.95419631038688
> newX <- newX[-31]
> length(newX)
[1] 30
> wt <- dwt(newX,filter="la8",n.levels=5, boundary="periodic", fast=FALSE)
Error in dwt(newX, filter = "la8", n.levels = 5, boundary = "periodic",  :
  Invalid argument value: 'n.levels' cannot be greater than 4.90689059560852

Generally speaking, is there a formula or rule to calculate the highest scale level 
when applying the Discrete Wavelet Transform to a time series of known length ?

Thank you very much in advance for your assistance.

Best regards,
Maura Monville


tutti i telefonini TIM!


	[[alternative HTML version deleted]]

