# Calculate the detail sequences for wavelet transform crystals

### Description

Let *W(j,n)* be a discrete
wavelet packet crystal where *j* is the
decomposition level and *n* is the oscillation
index. The detail sequence *D(j,t)*
is formed (essentially) by reconstructing the transform after zeroing out all other crystals
except *W(j,n)*.
The `wavMRD`

function
calculates the details for a DWT and MODWT in an optimized way.

### Usage

1 |

### Arguments

`x` |
an object of class |

`level` |
an integer (vector) containing the decomposition level(s) corresponding to the
crystal(s) to be decomposed. Default: If the input is of
class |

`osc` |
an integer (vector) containing the oscillation indices corresponding to the crystal(s)
to be decomposed. Default: the default values are coordinated with that of the |

### Value

an object of class `WaveletMRD`

.

### S3 METHODS

- [
single level data access.

Usage: x["D2"] or x["S4"]

Access a subset of wavelet transform details/smooth.

- [<-
single level data replacement method.

Usage: x["D2"] <- 1:4

Replace an entire wavelet transform details/smooth with explicitly defined coefficients.

- [[
double level data access.

Usage: x[["D2"]] or x[[2]]

Returns a vector of wavelet transform detail/smooth coefficients corresponding to the specified crystal.

- as.matrix
transforms the list of wavelet transform details/smooth coefficients into a single-column matrix whose row names identify the transform coefficient, e.g., D4(3) is the third coefficient of the

`D4`

detail.Usage: as.matrix(x)

- boxplot
plots a boxplot for each wavelet transform detail/smooth.

Usage: boxplot(x)

- crystal.names
return the crystal names for each wavelet transform detail/smooth.

Usage: crystal.names(x)

- plot
plot a stack plot of the discrete wavelet transform details/smooth. Usage: plot(x, n.top=15, vgap=.05, col=1, show.sum=TRUE, add=FALSE, ...)

- x
A

`wavMRD`

object.- n.top
An integer defining the (maximum) number of top-most energetic crystals to plot. Default:

`15`

.- sort.energy
A logical value. If

`TRUE`

, the crystals are sorted in the display from the most energetic (top) to the least energetic (bottom) of the specified`n.top`

crystals. Default:`FALSE`

.- vgap
A numeric scalar defining the vertical gap between plots expressed as a fraction of the maximum value of the details/smooth that are plotted. Default:

`0.05`

.- col
An integer or vecto rof integers deining the color index to apply to each detail/smooth line plot. Default:

`1`

.- show.sum
A logical value. If

`TRUE`

, a plot of the sum of all details/smooth is also plotted. Default:`TRUE`

.- add
A logical value. If

`TRUE`

, the plot is added to the current plot layout without a frame ejection. Default:`FALSE`

.- ...
Additional arguments to be sent to the plot routine.

print the wavelet transform details/smooth object. Usage: print(x)

- reconstruct
reconstruct/synthesize/invert the wavelet transform details/smooth. Usage: reconstruct(x)

If the transform coefficients were not modified, the original time series will be returned (+/- some numerical noise).

- summary
provide a statistical summary of the wavelet transform details/smooth object. Usage: z <- summary(x); print(z)

- wavStackPlot
stack plot of the wavelet transform details/smooth. Usage: wavStackPlot(x)

### References

D. B. Percival and A. T. Walden,
*Wavelet Methods for Time Series Analysis*, Cambridge University Press, 2000.

### See Also

`wavMRDSum`

, `reconstruct`

, `wavDWT`

, `wavMODWT`

.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## calculate various wavelet transforms of the
## first difference of a linear chirp sequence
x <- make.signal("linchirp", n=1024)
x.dwt <- wavDWT(x, n.levels = 3)
x.modwt <- wavMODWT(x, n.levels = 3)
## calculate the wavelet details for all crystals
## of the DWT and MODWT
wavMRD(x.dwt)
wavMRD(x.modwt)
## plot the wavelet details for levels 1 and 3 of
## the MODWT
plot(wavMRD(x.modwt, level = c(1,3)))
## plot the wavelet details for all levels of the
## MODWT of a linear chirp.
plot(wavMRD(x.modwt))
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.