Forms a multiresolution decomposition (MRD) by taking a specified discrete wavelet transform of the input series and subsequently inverting each level of the transform back to the "time" domain. The resulting components of the MRD form an octave-band decomposition of the original series, and can be summed together to reconstruct the original series. Summing only a subset of these components can be viewed as a denoising operation if the "noisy" components are excluded from the summation.
wavMRDSum(x, wavelet="s8",
levels=1, xform="modwt", reflect=TRUE,
keep.smooth=TRUE, keep.details=TRUE)
a vector containing a uniformly-sampled real-valued time series.
a logical value. If TRUE
, the details
corresponding to the specified levels are included in the partial summation
over the MRD components. The user also has the choice to
exclude the smooth in the summation via the keep.smooth
option,
but one of keep.details
and keep.smooth
must be TRUE
.
Default: TRUE
.
a logical value. If TRUE
, the smooth
at the last decomposition level is added to the partial summation
over specified details. The smooth typically contains low-frequency trends present in
a series, so removing the smooth (keep.smooth=FALSE
) will result
in removing the trend in such cases. The user also has the choice to
exclude the details in the summation via the keep.details
option,
but one of keep.details
and keep.smooth
must be TRUE
.
Default: TRUE
.
an integer vector of integers denoting the MRD detail(s) to sum over in forming
a denoised approximation to the orginal series (the summation is performed across scale and nto across time).
All values must be positive integers,
and cannot exceed floor(logb(length(x),2))
if reflect=FALSE
and, if reflect=TRUE
, cannot exceed
floor(logb((length(x)-1)/(L-1) + 1, b=2))
where \(L\) is the length of the wavelet filter. Use
the keep.smooth
option to also include the last level's smooth in the summation.
Default: 1
.
a logical value. If TRUE
, the
last \(L_J = (2^{\mbox{n.level}} - 1)(L - 1) + 1\)
coefficients of the series are reflected (reversed and appended to the end
of the series) in order to attenuate the adverse effect of circular
filter operations on wavelet transform coefficients for
series whose endpoint levels are (highly) mismatched.
The variable \(L_J\) represents the effective filter length at
decomposition level n.level
, where \(L\)
is the length of the wavelet (or scaling) filter.
A similar operation is performed at the beginning of the series.
After synthesis and (partial) summation of the resulting details
and smooth, the middle \(N\) points of the result are returned, where \(N\) is the length
of the original time series.
Default: TRUE
.
a character string denoting the filter type.
See wavDaubechies
for details. Default: "s8"
.
a character string denoting the wavelet transform type.
Choices are "dwt"
and "modwt"
for the discrete wavelet transform (DWT)
and maximal overlap DWT (MODWT), respectively. The DWT is a decimated transform
where (at each level) the number of transform coefficients is halved. Given
\(N\) is the length of the original time series, the total
number of DWT transform coefficients is \(N\).
The MODWT is a non-decimated transform where the number of
coefficients at each level is \(N\) and the total number of
transform coefficients is \(N\)*n.level
. Unlike the DWT, the MODWT
is shift-invariant and is seen as a weighted average of all possible
non-redundant shifts of the DWT. See the references for details.
Default: "modwt"
.
a vector containing the denoised series.
Performs a level \(J\) decimated or undecimated discrete wavelet transform on the input series and inverts the transform at each level separately to produce details \(D_1,\ldots,D_J\) and smooth \(S_J\). The decomposition is additive such that the original series \(X\) may be reconstructed ala \(X = S_J + \sum_{j=1}^J D_j\). As the effective wavelet filters at level \(j\) are nominally associated with approximate band pass filters, the details \(D_j\) correspond approximately to normalized frequencies on the interval \([1/2^{j+1}, 1/2^j]\), while the content of the smooth \(S_J\) corresponds approximately to normalized frequencies \([0, 1/2^{J+1}]\). The collection of details and smooth form a multiresolution decomposition (MRD).
With the intent of removing unwanted noise events,
a summation over a subset of MRD components may be
calculated yielding a smooth approximation to the
original series. For example, summing all MRD components
beyond \(D_1\) is tantamount to a low-pass filtering
of the original series (whether or not this is a relevant
and sufficient noise removal technique is left to the discretion
of the practitioner). This function allows the user to specify
the decomposition levels they wish to sum over in order to form
a multiresolution approximation. The inclusion of the last level's smooth
in the summation is controlled by the optional keep.smooth
argument.
The user may also select either a decimated wavelet transform (DWT) or an undecimated wavelet transform (MODWT). However, we recommend that the user stick with the MODWT for the following reasons:
Unlike the DWT, the MODWT is translation invariant, meaning that a (circular) shift of the input series will result in a corresponding (circular) shift of the transform coefficients.
The MODWT coefficients are a result of cycle-spinning, where averages are taken over all unique DWTs resulting from various circular shifts of the original series. The resulting MODWT MRD is relatively more smooth than the corresponding DWT MRD.
Unlike the DWT MRD, the MODWT MRD produces components that are associated with exactly zero phase filter operations such that events (such as peaks) in the details and smooth line up exactly with those of the original series.
The DWT is faster than the MODWT, but the MODWT is still quite fast, requiring multiplication and summation operations on the same order as the popular Fast Fourier Transform.
D. B. Percival and A. T. Walden, Wavelet Methods for Time Series Analysis, Cambridge University Press, 2000.
T.W. Randolph and Y. Yasui, Multiscale Processing of Mass Spectrometry Data, Biometrics, 62:589--97, 2006.
# NOT RUN {
## create a MODWT-based MRD of the sunspots series
## and sum over decomposition levels 4 to 6
x <- as.vector(sunspots)
z1 <- wavMRDSum(x, levels=4:6)
ifultools::stackPlot(x=as.vector(time(sunspots)),
y=list(sunspots=x, "D4+D5+D6"=z1),
ylim=range(x,z1))
# }
Run the code above in your browser using DataLab