hwt(x, type = c("wavelet", "station"), reindex = FALSE)wd. If FALSE then the
coefficients that are returned are "as is"
nlevels which contains the scaling function coefficients.
The coarsest scale coefficients are to be found in the lowest-indexed
slots of the list (e.g. c[[1]]) and increasing slot index corresponds
to finer scales. So, c[[length(c)]] corresponds to the finest
coefficients. Note, an entry in the slot can also be NULL. This
indicates that no coefficients could be calculated at this scale,
usually the coarsest.c but for wavelet coefficients.reindex=TRUE then this number will be the log to base 2
of the smallest power of two larger than the length of the input
vector x."wavelet") or a nondecimated transform ("station").
Note, the name of the argument "station" has been chosen
to coincide with the type in the regular wavelet
transform computed by wd.TRUE or FALSE. If TRUE then
the scale levels correspond directly to those computed by
wd, the regular wavelet transform. If FALSE then
the levels returned in c and d are just indexed from
the first non-null level.c(1, -1)/sqrt(2). However, from the three coefficients
that result from this, there is only one pair, so only one
"next coarser" coefficient can be computed. The reindex option is subtle. Essentially, it tries to
ensure that the returned coefficients end up at the same
scales as if a data set of the next highest dyadic length was
analyzed by the wd function. E.g. if the length of the
series was 10 then with reindex=FALSE (default)
only three levels are returned for each of the wavelet and
scaling coefficients. If reindex=TRUE then the number
of levels returned would be as if wd analysed a data set
of length 16 (the smallest dyadic number larger than 10).
The wd levels would be zero to three and this is what
would be returned in this function if reindex=TRUE.
However, note, in this case, the coarsest level coefficient
happens to be NULL (or not computable). One can view the algorithm
as computing a partial transform of 10 of the 16 elements and
substituting NA for anything it can't compute.
Priestley, M.B. and Subba Rao (1969) A test for non-stationarity of time series. J. R. Statist. Soc. B, 31, 140-149.
von Sachs, R. and Neumann, M.H. (2000) A wavelet-based test for stationarity. J. Time Ser. Anal., 21, 597-613.
hwtos,
plot.hwtANYN, print.hwtANYN,
summary.hwtANYN
#
# Generate test data set of length 5 (note, NOT a power of two)
#
v2 <- rnorm(5)
#
# Compute its Haar transform
#
v2hwt <- hwt(v2)
#
# How many levels does it have?
#
nlevelsWT(v2hwt)
#
# What are the coarsest scale wavelet coefficients
#
v2hwt$d[[1]]
#
# What are the finest scale scaling function coefficients
#
v2hwt$c[[nlevels(v2hwt$c)-1]]
Run the code above in your browser using DataLab