This function is generic (see Methods); method functions can be written to handle specific classes of data. Classes which already have methods for this function include:
cpt, cp.molecule, dwt, nd.dwt, rob.dwt, wpt, wp.molecule.
decompose(x, top=NULL, data=NULL, order.crystal="energy")
When x is of class "cpt" or "wpt", all atoms with non-zero coefficients are included in the decomposition, the sum of the components yields the original series.
When x is of class "cp.molecule" or "wp.molecule", if data is provided, the sum of the components yields an approximation of the data with a (non-trivial) residual term attached at the end of the outcome matrix. The bigger the top, the closer the approximation to the original signal; if data is missing, the sum of the components only yields an approximation to the original signal.
xx <- make.signal("ramp", 1024) par(mfrow=c(2,2)) plot(xx, type="l", xlab="") xx.dwt <- dwt(xx, wavelet="s8", n.levels=4) plot(xx.dwt) xx.dec <- decompose(xx.dwt) plot(xx.dec) xx.top <- top.atoms(xx.dwt, n.atoms=10) xx.dec1 <- decompose(xx.top, data=xx) # decompose signal on the top 10 atoms plot(xx.dec1)