WaveThresh Help
Use `threshold()' on a `wd' object
DESCRIPTION
Applies hard or soft thresholding to wavelet decomposition
object "wd.object".
USAGE
threshold.wd(wd, levels = 3:(wd$nlevels - 1), type = "hard", policy = "sure",
by.level = F, value = 0, dev = var, boundary = F, verbose = F,
return.threshold = F, force.sure = F, cvtol = 0.01)
REQUIRED ARGUMENTS
- wd
- Object of class "wd",
maybe from a wavelet decomposition using the
wd function.
OPTIONAL ARGUMENTS
- levels
- vector that determines which levels are thresholded in
the decomposition
- type
- Determines the type of thresholding, this can be "hard"
or "soft"
- policy
- which threshold to use, this can be
"sure", "cv",
"universal", "manual",
"mannum" or "probability",
- by.level
- If F then a global threshold is applied to all the
levels specified by "levels", otherwise a threshold is
computed and applied separately to each level.
- value
- This is the user-supplied: threshold for the
manual policy;
number of ordered coefficients for the mannum
policy; and the user-supplied quantile level for the
probability policy.
- dev
- deviance measure. The default is to use the var()
function, but you can insert your own measure of deviance.
- boundary
- If this is true then the boundary correction values
are included for thresholding, if it is false then they
are not.
- verbose
- If true then threshold prints informative messages at
you.
- return.threshold
- If this is true then the actual threshold is
returned, otherwise the thresholded object is returned.
- force.sure
- If true then the SURE procedure is applied to all
levels. If false then if there is not enough signal in a
level universal
thresholding is sometimes used for that level.
- cvtol
- The termination tolerance for the cross-validation
optimisation. This is the relative tolerance for
convergence of the threshold value.
VALUE
An object of class "wd" that has been thresholded.
SIDE EFFECTS
None
DETAILS
Thresholding modifies the coefficients within a wd
wavelet
decomposition object. The modification can be performed
either with a "hard" or "soft" thresholding selected by
the "type" argument.
Hard thresholding simply compares a coefficient with a
threshold. If it is larger in absolute magnitude it is
left alone, if it is smaller it is set to zero. The "soft
threshold" formula is
soft(w) = sgn(w)*max(|w| - t, 0)
where "w" is the wavelet coefficient, "t" is the threshold
and "sgn" is the sign of w. Soft thresholding causes w to
be replaced by soft(w).
There are many ways that the threshold can be computed, we
term this the "policy" and these are described next.
A universal policy computes a
threshold based on
Donoho
and Johnstone's "universal
thresholds". The threshold is sqrt(2*log(n))*noise, where
noise is computed as sqrt(dev(w)), i.e. some measure of
the variability of the coefficients, and n is the number
of data points (or number of wavelet coefficients). By
default "dev" is "var", so the noise level is estimated
using the sample standard deviation. You can use any other
such estimate by writing your own function and supplying
it as the "dev" argument. For example you could create the
function "myvar" by
myvar <- function(d) mad(d)^2
(Actually this is implemented in WaveThresh, and called
madmad).
This computes the square of the mean absolute deviation of
the data. It is squared because "dev" should be a measure
on the variance scale, not the standard deviation (you
know what I mean). If you make the "by.levels" argument
T, then a separate threshold is computed for each level in
the "levels" vector. This means that the variance is
estimated separately for each level.
The "sure" policy is described by Donoho and
Johnstone (1993).
Choosing the
threshold using by cross-validation is described in
Nason (1996).
Discussion of both these methods here is beyond the scope
of this help.
The "manual" policy is simple. You supply a threshold
value ("value") and hard or soft thresholding is performed
using that value. The "value" argument is a vector. If it
is of length 1 then it is replicated to be the same length
as the "levels" vector, otherwise it is repeated as many
times as necessary to be the length vector's length. In
this way, different thresholds can be given for different
levels. Note that the "by.level" argument has no effect
with this policy.
The "mannum" policy is also very simple. You decide how
many coefficients you want to keep (e.g. say you want to
keep the smallest coefficients [smallest in
absolute magnitude]) and supply that number to the value
argument.
The "probability" policy works as follows. All
coefficients that are smaller than the "value"th quantile
of the coefficients are set to zero. If "by.level" is
false, then the quantile is computed for all coefficients
in the levels specified by the "levels" vector; if
"by.level" is true, then each level's quantile is
estimated separately. The probability policy is pretty
stupid - do not use it.
This function is a method for the generic function
threshold for class "wd".
It can be invoked by calling
threshold
for an object of the appropriate class, or
directly by calling threshold.wd regardless of the class
of the object.
RELEASE
Version 3.5.3 Copyright Guy Nason 1994
REFERENCES
Donoho, D.L. and Johnstone, I. M. (1992)
Ideal Spatial Adaptation via Wavelet Shrinkage. Stanford University,
Department of Statistics Technical Report, Number 400.
Donoho, D.L. and Johnstone, I. M. (1993)
Adapting to Unknown smoothness via Wavelet Shrinkage. Stanford University,
Department of Statistics Technical Report, Number 425.
Nason, G.P. (1996)Wavelet
shrinkage using cross-validation. Journal of the Royal Statistical
Society, Series B, 58, 463--479
BUGS
There should be an optimal policy as well, although
universal is meant to come close.
SEE ALSO
`wr', `wd'
EXAMPLES
See example for threshold.
Wavelets Home Page
G.P.Nason@bristol.ac.uk