Learn R Programming

mwaved (version 1.1.8)

waveletThresh: Apply thresholding regime to a set of wavelet coefficients

Description

Applies a resolution level thresholding technique to a set of wavelet coefficients, embedded in a wavelet coefficient object.

Usage

waveletThresh(beta, thresh, shrinkType = "hard")

Arguments

beta

A waveletCoef object.

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'.

Details

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: \( \delta(x) = x 1(|x| > t) \)

  • Soft: \( \delta(x) = (x - t) 1(x > t) + (x + t) 1(x > -t) \)

  • Garrote: \( \delta(x) = (x - t^2/x) 1(|x| > t) \)

where 1 represents the indicator function and t > 0 represents the threshold.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab