Skip to contents

Re-sifts a sequence of modes, typically the averaged modes of an ensemble, by extracting the first sifted component of consecutive sums and carrying each remainder to the next mode.

Usage

resiftModes(modes, sifting)

Arguments

modes

Finite numeric matrix, samples by modes, with at least two columns \(D_1, \ldots, D_K\).

sifting

Named list of sifting controls, as in decomposeEMD; the rule "consecutive" is rejected. The chain has \(K - 1\) extractions, so sifting$maxModes does not apply.

Details

With \(u_1 = D_1 + D_2\), stage \(i\) extracts \(a_i = E_1(u_i)\), keeps the remainder \(q_i = u_i - a_i\) and adds the next mode, \(u_{i+1} = q_i + D_{i+2}\). The completed chain returns \(K - 1\) modes and the residue \(q_{K-1}\) with "chainComplete", and $$\sum_{i=1}^{K-1} a_i + q_{K-1} = \sum_{j=1}^{K} D_j.$$ When \(E_1(u_i)\) does not exist, the chain ends with "insufficientExtrema", the modes \(a_1, \ldots, a_{i-1}\) and the residue \(u_i + \sum_{j > i + 1} D_j\), which keeps the same sum.

Value

A list with

modes

Double matrix, samples by the extracted modes.

residue

Numeric vector, the remainder of the chain.

iterations

Integer vector, the subtractions of each extraction.

converged

Logical vector by extraction, as in decomposeEMD.

stopReason

"chainComplete" or "insufficientExtrema".

References

The selection of the reflected extrema and the spline interpolation of the envelope nodes are adapted from emd.m (G. Rilling, March 2007), distributed with CEEMDAN revision af9a0f83, copyright (c) 2020 Marcelo A. Colominas, MIT License; see the NOTICE file of the installed package.

Examples

Time <- seq(0, 9, length.out = 1000)
Signal <- sin(pi * Time) + sin(2 * pi * Time) + sin(6 * pi * Time) +
    0.5 * Time
set.seed(628)
Noise <- t(matrix(stats::rnorm(10L * length(Signal)), nrow = 10L,
                  byrow = TRUE))
Sifting <- list(stopRule = "doubleThreshold", thresholds = c(0.05, 0.5),
                fraction = 0.05, maxSift = 2000, boundary = "reflection",
                maxModes = Inf)
# Two of the ten realizations keep the example short.
Modes <- decomposeEEMD(Signal, noise = Noise[, 1:2], amplitudeRatio = 0.2,
                       divisor = "realizations", sifting = Sifting)$modes
OUT <- resiftModes(Modes, sifting = Sifting)
c(input = ncol(Modes), output = ncol(OUT$modes))
#>  input output 
#>      7      6 
OUT$stopReason
#> [1] "chainComplete"
max(abs(rowSums(OUT$modes) + OUT$residue - rowSums(Modes)))
#> [1] 4.440892e-16