Wavelet Shrinkage Smoothing

DESCRIPTION:

Data smoothing or signal denoising by wavelet shrinkage.

USAGE:

waveshrink(x, ..., shrink.rule=NULL, shrink.fun="soft", 
           scale.rule=NULL, scale.fun="mad", p=2, 
           smooth.levels=NULL, which.shrink=NULL, 
           zero.crystal=NULL, n.top=NULL, 
           vshrink=NULL, vscale=NULL, decimate=T) 

REQUIRED ARGUMENTS:

x
a numeric vector or an object of class wpt or cpt (e.g., an outcome of dwt, best.basis, best.level).

OPTIONAL ARGUMENTS:

...
additional arguments such as wavelet, n.levels, for dwt (if decimate=TRUE) or nd.dwt (if decimate=FALSE). See dwt or nd.dwt for details. In effect only when x is a numeric vector.
shrink.rule
character string indicating the rule used to compute the thresholds, available rules: "adapt", "minimax", "sure", "top" and "universal". See below for details. This argument will be ignored if argument vshrink is supplied.
shrink.fun
character string indicating which shrinkage function to use: "soft" and "hard" are available. See shrink for details.
scale.rule
character string giving indicating the rule used to estimate the noise scale, available rules: "all", "each" and crystal.name. See details below. This argument will be ignored if argument vscale is supplied.
scale.fun
character string indicating which function to use to compute the noise scale: "lp", "mad" and "sd". See details below. This argument will be ignored if argument vscale is supplied.
p
real number >= 1, needed only when scale.fun="lp".
smooth.levels
an integer `<= n.levels', indicating the number of levels to be shrunk. The default is n.levels-2. This argument will be ignored if x is a wpt or cpt object.
which.shrink
a character or logical vector indicating which crystals to be shrunk. When x is a numeric vector or dwt object, the default is to shrink all but the first coarsest levels; otherwise, the default is to shrink all crystals.
zero.crystal
a vector of character strings or logical indicating which crystals to be set to zero.
n.top
number of biggest coefficients used for reconstruction. When n.top is specified, shrink.rule is set to top.
vshrink
a numerical vector of user provided thresholds. Let m=length(vshrink), if m=1, all crystals use the same threshold; if m is less than the number of crystals, the last m crystals will be shrunk; if m is bigger than the number of crystals, vshrink is set to `vshrink[1:m]'.
vscale
a numerical vector of user provided scales. Let m=length(vscale), if m=1, all crystals use the same scale; if m is less than the number of crystals, the last m crystals will be rescaled; if m is bigger than the number of crystals, vscale is set to `vscale[1:m]'.
decimate
logical flag indicating if decimated DWT or non-decimated DWT is used. In effect only when x is a numeric vector.

VALUE:

a smoothed signal of class "waveshrink", "waveshrink.rts" or "waveshrink.ts" with the same structure as input x and the original and the shrunk coefficients as attributes.

DETAILS:

Available shrink.rules:

adapt

a hybrid scheme, proposed by Donoho and Johnstone (1992b), which combines the universal and sure (if the vector is not sparse), see chapter "Nonparametric Estimation with Wavelets" of the S+WAVELETS User's Manual for details.

minimax
minimax threshold has been computed by Donoho and Johnstone (1992a) for a range of sample sizes. It is derived based on "soft" shrinking and the minimax theory. This is typically smaller the the universal thershold, and thus results in less smoothing.
sure
Stein's Unbiased Risk Estimator: see Donoho and Johnstone (1992b).

top
keep (if shrink.fun="hard") or shrink (if shrink.fun="soft") the n.top number of largest coefficients and set all the other coefficients to zero. This method is equivalent to using the 1-n.top/n-th quantile as the threshold, where n is the sample size.
universal
the universal threshold is defined by sqrt(2*log(n)) where n is the sample size. The universal threshold is the default method and yields the largest threshold. As a result, using universal threshold results in a relatively high degree of smoothness. See Donoho and Johnstone (1992a) for more details.



Available scale.rules:
all

use all of the detail coefficients are used to estimate a single scale factor for all levels.

each
for each crystal, compute its own scale.
"crystal.name"
use the specified crystal(s) to estimate a single scale factor. When x is a numeric vector or a dwt object, the default is d1, the finest detail coefficients.



Available scale.fun:
lp

the usual Lp norm.

mad


median of absolute deviation from the median, defined by median(|x-median(x)|)/0.6745. The S-PLUS function mad(x, center=0) is called.
sd


the usual standard deviation, sqrt(var(x)) .



Refer to the chapter "Nonparametric Estimation with Wavelets" in the S+WAVELETS User's Manual for additional references, examples, and more details.

REFERENCES:

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

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

SEE ALSO:

, , , .

EXAMPLES:

par(mfrow=c(1, 2)) 
xx <- make.signal("blocks", n=512, snr=7) 
plot(xx, type="l", xlab="noisy blocks", ylab="") 
yy <- waveshrink(xx, wavelet="d2") 
plot(yy, type="l", xlab="smoothed blocks", ylab="")