msDenoiseWaveletThreshold {msProcess}R Documentation

Wavelet Shrinkage Threshold Test

Description

Performs waveshrink on a given spectrum over a (wide) range of thresholds. For each threshold, a waveshrunk version of the input spectrum is calculated and a separation statistic is formed based on the absolute difference between the waveshrunk output and an infinitely smooth reference series. The reference series is a the result of waveshrinking the input spectrum with a very large threshold, where (nearly) all the wavelet coefficients are (shrunk toward) zero in the shrinkage process. The plot method can be used to display an image of the separation statistics over the specified range of thresholds and corresponding m/z values. This technique eliminates adaptive thresholding, where a unique threshold is used to shrink the wavelet coefficients at different scales, since only a single threshold is supplied.

Usage

msDenoiseWaveletThreshold(x, wavelet="s8",
    n.level=as.integer(floor(logb(length(x), 2))),
    shrink.fun="hard", thresh.scale=NULL,
    xform="modwt", reflect=TRUE, n.threshold=500,
    thresh.fun="universal", noise.variance=NULL,
    min.thresh=NULL, max.thresh=NULL)

Arguments

x A vector containing a uniformly-sampled real-valued time series, typically a mass spectrum.
min.thresh, max.thresh Numeric scalars defining the threshold range. These arguments are only used if the default value of the thresh.scale argument is used, i.e., thresh.scale=NULL. Default: range(abs(wavelet coefficients)) using the specified transform.
n.level The number of decomposition levels, limited to floor(logb(length(x),2)). Default: as.integer(floor(logb(length(x), 2))).
n.threshold The number of thresholds. This argument is only used if the default value of the thresh.scale argument is used, i.e., thresh.scale=NULL. This argument must be a positive integer. Default: 500.
noise.variance A numeric scalar representing (an estimate of) the additive Gaussian white noise variance. If unknown, setting this value to 0.0 (or less) will prompt the function to automatically estimate the noise variance based on the median absolute deviation (MAD) of the scale one wavelet coefficients. Default: NA (MAD estimate will be used).
reflect A logical value. If TRUE, the last Lj = (2^n.level - 1)(L - 1) + 1 coefficients of the series are reflected (reversed and appended to the end of the series) in order to attenuate the adverse effect of circular filter operations on wavelet transform coefficients for series whose endpoint levels are (highly) mismatched. The variable Lj represents the effective filter length at decomposition level n.level, where L is the length of the wavelet (or scaling) filter. After waveshrinking and reconstructing, the first N points of the result are returned, where N is the length of the original time series. Default: TRUE.
shrink.fun A character string denoting the shrinkage function. Choices are "hard", "soft", and "mid". Default: "hard".
thresh.fun A character string denoting the threshold function to use in calculating the waveshrink thresholds.
character string
Choices are "universal", "minimax", and "adaptive".

numeric values
Either a single threshold value or a vector of values containing n.levels thresholds (one threshold per decomposition level).

Note: if xform == "modwt", then only the "universal" threshold function is (currently) supported. Default: "universal".
thresh.scale A numeric vector containing the threshold values to use in denoising the wavelet coefficients. This vector must contain at least two numeric values. Default: seq(min(abs(wavelet coefficients)), max(abs(wavelet coefficients)), length=n.threshold) where wavelet coefficients are defined by the specified transform. This range of thresholds allows the user to explore values over all the effective threshold levels.
wavelet A character string denoting the filter type. See wavDaubechies for details. Default: "s8".
xform A character string denoting the wavelet transform type. Choices are "dwt" and "modwt" for the discrete wavelet transform (DWT) and maximal overlap DWT (MODWT), respectively. The DWT is a decimated transform where (at each level) the number of transform coefficients is halved. Given N is the length of the original time series, the total number of DWT transform coefficients is N. The MODWT is a non-decimated transform where the number of coefficients at each level is N and the total number of transform coefficients is N*n.level. Unlike the DWT, the MODWT is shift-invariant and is seen as a weighted average of all possible non-redundant shifts of the DWT. See the references for details. Default: "modwt".

Value

An object of class msDenoiseWaveletThreshold.

S3 METHODS

plot
Plots an image of the separation statistics as a function of threshold (ordinate) and m/z value (abscissa). For reference, a line plot of the original and infinitely smoothed spectra are overlaid on the image. Available options are:
xlab
character string defining x-axis label. Default: "m/z".
ylab
character string defining y-axis label. Default: "Waveshrink Threshold".
lty
an integer denoting the line type ala the par function. Default: 1.
lwd
an integer denoting the line width ala the par function. Default: 2.
...
additional argument sent directly to the lines function used to overlay the image with the original and infiniteluyu smooth spectra.
print
Prints a summary of the returned object. Available options are:
justify
text justification ala the format function. Default: "left".
sep
header separator. Default: ":".

References

Donoho, D. and Johnstone, I. Ideal Spatial Adaptation by Wavelet Shrinkage. Technical report, Department of Statistics, Stanford University, 1992.

Donoho, D. and Johnstone, I. Adapting to Unknown Smoothness via Wavelet Shrinkage. Technical report, Department of Statistics, Stanford University, 1992.

D. B. Percival and A. T. Walden, Wavelet Methods for Time Series Analysis, Cambridge University Press, 2000.

http://bioinformatics.mdanderson.org/sizer.html.

See Also

msDenoiseWavelet, msDenoise, rescale.

Examples

if (!exists("qcset")) data("qcset", package="msProcess")

## grab portion of a mass spectrum and plot
x <- qcset$intensity[5000:7000,1]

## create noise and add it to the spectrum portion
sd.noise <- 2
set.seed(100)
xnoise <- x + rnorm(length(x), sd=sd.noise)

## calculate the waveshrink separation statistics
z <- msDenoiseWaveletThreshold(xnoise)
print(z)
plot(z)

[Package msProcess version 1.0.5 Index]