Description Usage Arguments Value See Also Examples
Estimates the local noise level by applying a specified smoother function to the the noise data attached to the primary input variable.
1 2 3 |
x |
An object of class |
... |
Additional arguments to |
FUN |
Either an object of class character: A character string denoting the
method to use in smoothing the noise data.
Supported choices are function: A user-defined function with an argument list
of the form In either case, the additional arguments |
detach.noise |
A logical indicating if the noise removed previously
should be detached or not. Default: |
event |
A character string denoting the name of the
event to register with the (embedded) event history object of the input
after processing the input data. Default: |
pre |
A function that is applied to the data prior to
processing it with the function defined by |
An object of class msSet
with local noise estimate attached
as element "noise.local"
and optionally with the element "noise"
detached.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | if (!exists("qcset")) data("qcset", package="msProcess")
## denoise a noise contaminated spectrum portion
## via waveshrink
mz <- (qcset$mz > 3000 & qcset$mz < 5000)
data <- qcset[mz, 1, drop=FALSE]
noise <- rnorm(length(data$intensity), sd=stdev(data$intensity)/3)
xnoise <- data
xnoise$intensity <- data$intensity + matrix(noise, ncol=1)
z <- vector("list", length=4)
z[[1]] <- msDenoise(xnoise, FUN="wavelet")
## smooth the resulting noise estimates to form a
## localized estimate of the noise using
## various supported methods
z[[2]] <- msNoise(z[[1]], FUN="spline")
z[[3]] <- msNoise(z[[1]], FUN="loess")
## create a user-defined smoothing function
my.fun <- function(x, wavelet="d4"){
filt <- wavDaubechies(wavelet=wavelet, norm=FALSE)$scaling
return(filter(x, filt))
}
z[[4]] <- msNoise(z[[1]], FUN=my.fun, wavelet="s12")
## create a stackplot of the results
type <- c("noise", rep("noise.local", 3))
for (i in 1:4){
z[[i]] <- as.vector(z[[i]][[type[i]]])
}
names(z) <- c("noise","spline", "loess", "my function")
wavStackPlot(z, col=seq(along=z), same.scale=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.