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 Thank you very much in advance for your explanation. Best regards, Maura Monville tutti i telefonini TIM! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.