waveletThresh {mwaved} | R Documentation |
Applies a resolution level thresholding technique to a set of wavelet coefficients, embedded in a wavelet coefficient object.
waveletThresh(beta, thresh, shrinkType = "hard")
beta |
A |
thresh |
A numeric vector containing the thresholds to be applied to the coefficients at each resolution. |
shrinkType |
A character string that specifies which thresholding regime to use. Available choices are the 'hard', 'soft' or 'garrote'. |
Applies one of three specified wavelet thresholding regimes to a waveletCoef
object (wavelet
coefficient object created by multiCoef
). If thresh
is not specified, no thresholding
is applied. The formulae applied for 'hard', 'soft' or
'garrote' are given by,
Hard: δ(x) = x 1(|x| > t)
Soft: δ(x) = (x - t) 1(x > t) + (x + t) 1(x > -t)
Garrote: δ(x) = (x - t^2/x) 1(|x| > t)
where 1 represents the indicator function and t > 0 represents the threshold.
library(mwaved) # Simulate the multichannel doppler signal. m <- 3 n <- 2^10 signal <- makeDoppler(n) # Noise levels per channel e <- rnorm(m * n) # Create Gamma blur shape <- seq(from = 0.5, to = 1, length = m) scale <- rep(0.25, m) G <- gammaBlur(n, shape = shape, scale = scale) # Convolve the signal X <- blurSignal(signal, G) # Create error with custom signal to noise ratio SNR <- c(10, 15, 20) sigma <- sigmaSNR(X, SNR) if (requireNamespace("fracdiff", quietly = TRUE)){ alpha <- c(0.75, 0.8, 1) } else { alpha <- rep(1, m) } E <- multiNoise(n, sigma, alpha) # Create noisy & blurred multichannel signal Y <- X + E # Determine thresholds thresh <- multiThresh(Y, G) beta <- multiCoef(Y, G) betaShrunk <- waveletThresh(beta, thresh) plot(beta, betaShrunk)