Learn R Programming

locits (version 1.4)

ewspec3: Compute evolutionary wavelet spectrum of a time series.

Description

This function is a development of the ewspec function from wavethresh but with more features. The two new features are: the addition of running mean smoothing and autoreflection which mitigates the problems caused in ewspec which performed periodic transforms on data (time series) which were generally not periodic.

Usage

ewspec3(x, filter.number = 10, family = "DaubLeAsymm",
    UseLocalSpec = TRUE, DoSWT = TRUE, WPsmooth = TRUE,
    WPsmooth.type = "RM", binwidth = 5, verbose = FALSE,
    smooth.filter.number = 10, smooth.family = "DaubLeAsymm",
    smooth.levels = 3:WPwst$nlevels - 1, smooth.dev = madmad,
    smooth.policy = "LSuniversal", smooth.value = 0,
    smooth.by.level = FALSE, smooth.type = "soft",
    smooth.verbose = FALSE, smooth.cvtol = 0.01,
    smooth.cvnorm = l2norm, smooth.transform = I,
    smooth.inverse = I, AutoReflect = TRUE)

Arguments

x
The time series you want to compute the evolutionary wavelet spectrum for.
filter.number
Wavelet filter number underlying the analysis of the spectrum (see filter.select or wd for more details).
family
Wavelet family. Again, see filter.select or wd for more details.
UseLocalSpec
As ewspec, should usually leave as is.
DoSWT
As ewspec, should usually leave as is.
WPsmooth
If TRUE then smoothing is applied to the wavelet periodogram (and hence spectrum).
WPsmooth.type
The type of periodogram smoothing. If this argument is "RM" then running mean linear smoothing is used. Otherwise, wavelet shrinkage as in ewspec is used.
binwidth
If the periodogram smoothing is "RM" then the this argument supplies the binwidth or number of consecutive observations used in the running mean smooth.
verbose
If TRUE then messages are produced. If FALSE then they are not.
smooth.filter.number
If wavelet smoothing of the wavelet periodogram is used then this specifies the index number of wavelet to use, exactly as ewspec.
smooth.family
If wavelet smoothing of the wavelet periodogram is used then this specifies the family of wavelet to use, exactly as ewspec.
smooth.levels
If wavelet smoothing of the wavelet periodogram is used then this specifies the levels to smooth, exactly as ewspec.
smooth.dev
If wavelet smoothing of the wavelet periodogram is used then this specifies deviance used to compute smoothing thresholds, exactly as ewspec.
smooth.policy
If wavelet smoothing of the wavelet periodogram is used then this specifies the policy of wavelet shrinkage to use, exactly as ewspec.
smooth.value
If wavelet smoothing of the wavelet periodogram is used then this specifies the value of the smoothing parameter for some policies, exactly as ewspec.
smooth.by.level
If wavelet smoothing of the wavelet periodogram is used then this specifies whether level-by-level thresholding is applied, or one threshold is applied to all levels, exactly as ewspec.
smooth.type
If wavelet smoothing of the wavelet periodogram is used then this specifies the type of thresholding, "hard" or "soft", exactly as ewspec.
smooth.verbose
If wavelet smoothing of the wavelet periodogram is used then this specifies whether or not verbose messages are produced during the smoothing, exactly as ewspec.
smooth.cvtol
If wavelet smoothing of the wavelet periodogram is used then this specifies a tolerance for the cross-validation algorithm if it is specified in the smooth.policy, exactly as ewspec.
smooth.cvnorm
Ditto to the previous argument, but this one supplies the norm used by the cross-validation.
smooth.transform
If wavelet smoothing of the wavelet periodogram is used then this specifies whether a transform is used to transform the periodogram before smoothing, exactly as ewspec.
smooth.inverse
Should be the mathematical inverse of the smooth.transform argument.
AutoReflect
Whether the series is internally reflected before application of the wavelet transforms. So, x becomes c(x, rev(x)) which is a periodic sequence. After estimation of the spectrum the second-half of the spectral estimate is ju

Value

  • Precisely the same kind of output as ewspec.

References

Nason, G.P. (2013) A test for second-order stationarity and approximate confidence intervals for localized autocovariances for locally stationary time series. J. R. Statist. Soc. B, 75, 879-904.

See Also

AutoBestBW, lacf

Examples

Run this code
#
# Generate time series
#
x <- tvar1sim()
#
# Compute its evolutionary wavelet spectrum, with linear running mean smooth
#
x.ewspec3 <- ewspec3(x)
#
# Plot the answer, probably its a bit variable, because the default bandwidth
# is 5, which is probably inappropriate for many series
#
plot(x.ewspec3$S)
#
# Try a larger bandwidth
#
x.ewspec3 <- ewspec3(x, binwidth=100)
#
# Plot the answer, should look a lot smoother
#
# Note, a lot of high frequency power on the right hand side of the plot,
# which is expected as process looks like AR(1) with param of -0.9
#
plot(x.ewspec3$S)
#
# Do smoothing like ewspec (but additionally AutoReflect)
#
x.ewspec3 <- ewspec3(x, WPsmooth.type="wavelet")
#
# Plot the results
#
plot(x.ewspec3$S)
#
# Another possibility is to use AutoBestBW which tries to find the best
# linear smooth closest to a wavelet smooth. This makes use of ewspec3
#

Run the code above in your browser using DataLab