Learn R Programming

icaOcularCorrection (version 3.0.0)

mwd.thrsh: Multiple wavelet decomposition thresholding.

Description

Applies hard or soft multiple wavelet thresholding to a signal.

Usage

mwd.thrsh(data, verbosity = 3, ...)

Arguments

data
A vector containing the data you wish to threshold. If the length of this vector is not a power of 2 times the dimension of the DMWT (multiplicity of wavelets), the vector will be padded with approximately the same number of 0's at each end for processing and then removed once done.
verbosity
Numeric. The amount of information printed to screen during the modeling process. The higher the number, the more information is printed. 0 turns this option off. Defaults to 3. Maximum value is 3.
...
Further arguments to pass to functions mwd and wr.

Value

Details

The signal of small amplitude will be thrown away and the bigger peaks will remain. This function is here to experiment with the mwd thresholding of noise signals, more specifically, to determine whether first thresholding one or more noise signals improves correction. Might be good for EOG channels, i.e., would keep the bigger eye-movements and blinks and get rid of the other stuff, potentially resulting in the ICs that correlate with the thresholded EOGs being (close to) purely eye-movement artifacts. See ?mwd and ?wr of package wavethresh for details about these functions.

Examples

Run this code
if(try(require(wavethresh,quietly=TRUE))){
    blinks <- rep(c(rep(0,5),sin(1:10)*35,rep(0,15)),5)
    noise <- runif(length(blinks), min = -12, max = 12)
    blinks.thrsh <- mwd.thrsh(blinks + noise)
    
    ylimit <- c(-45, 80)
    plot(blinks + noise, type = "l", ylim = ylimit,
      ylab = "Amplitude", col = grey(0.4))
    lines(blinks.thrsh, col = "red", lty = 2)
    lines(blinks, col = "blue", lty = 3)
    legend("topleft", legend = c("Blinks + Noise", 
      "Thresholded Blinks + Noise", "Blinks only"), 
      lty = c(1, 2, 3), col = c(grey(0.4), "red", 
      "blue"), bty = "n", cex = 0.75)
}

Run the code above in your browser using DataLab