thresholding {trendsegmentR} | R Documentation |
Noise reduction from the sequence of detail coefficients returned by the Tail-Greedy Unbalanced Wavelet (TGUW) transformation
Description
This function is used inside trendsegment
and performs the thresholding of the detail coefficients returned by the Tail-Greedy Unbalanced Wavelet (TGUW) transformation.
The denoising is achieved by a prespecified threshold in a "connected" way in that it prunes the branches if and only if
the detail coefficient itself and all of its children coefficients are below some thresholds in its size. Also, the
"two together" rule is applied to any paired detail coefficients returned by Type 3
merging (merging two sets of paired smooth coefficients) in the sense that both detail coefficients should be survived if at least one of their size is over threshold. For details, see H. Maeng and P. Fryzlewicz (2023), Detecting linear trend changes in data sequences.
Usage
thresholding(ts.obj, lambda, minsegL, bal = 0, connected = FALSE)
Arguments
ts.obj |
A list returned by |
lambda |
The magnitude of the threshold. It has a form of |
minsegL |
The minimum segment length of estimated signal returned by |
bal |
The minimum ratio of the length of the shorter region to the length of the entire merging region especially when the merges of Type 2 (merging one initial and a paired smooth coefficient) or of Type 3 (merging two sets of (paired) smooth coefficients) are performed. Only triplets which satisfy this balancedness condition survives in denoising. Point anomalies can be detected only if |
connected |
If connected=TRUE, the thresholding puts the connected rule above the |
Value
ts.obj |
The modified ts.obj containing zero detail coefficients in the |
Author(s)
Hyeyoung Maeng hyeyoung.maeng@durham.ac.uk, Piotr Fryzlewicz p.fryzlewicz@lse.ac.uk
See Also
Examples
x <- c(1:10, rep(5,9))
n <- length(x)
x <- x + rnorm(n)
tguwfit <- TGUW(x)
th.const <- 1.3
lambda <- (stats::mad(diff(diff(x)))/sqrt(6)) * sqrt(2 * log(n)) * th.const
thrfit <- thresholding(ts.obj = tguwfit, lambda = lambda, minsegL = 5, bal = 0, connected = FALSE)
thrfit