Estimate Spectrum with Wavelet Shrinkage

DESCRIPTION:

Estimates the spectrum of a time series by wavelet shrinkage, and optionally plots the spectral estimate.

USAGE:

spec.wave(x, wavelet="s8", n.levels=6, shrink.level=NULL, 
          detrend=T, plot=T, shrink.fun="soft", taper=.1) 

REQUIRED ARGUMENTS:

x
a univariate time series.

OPTIONAL ARGUMENTS:

wavelet
a character string giving the name of the wavelet, e.g. "d4", "s8". See wavelet for a list of all available wavelet names.
n.levels
a non-negative integer specifying number of multi-resolution levels. if n.levels is bigger than ml, where ml is the maximum possible level, computed from the max.level function, then n.levels is set to ml and a warning message is given.
shrink.level
number of levels to be shrunk, default value is n.levels-1.
detrend
if TRUE, remove a least squares line from the time series before computing periodogram.
plot
if TRUE, a plot of the spectrum will be provided. See spec.plot for details.
shrink.fun
shrink function: soft and hard, default is soft. See shrink for details.
taper
fraction of each end of the time series that is to be tapered. See spec.pgram for details.

VALUE:

a list with the following components:
freq
the sequence of frequencies at which the spectrum is estimated.
spec
a vector of estimated spectrum on the decibel scale ( 10*log10(power)).
series
the name used for the input series as a character string.
method
the string " WaveShrink" followed by the filter name used in the analysis and shrink.level.
raw.dwt
original wavelet coefficients.
shr.dwt
shrunk wavelet coefficients.
threshold
a vector of thresholds.

DETAILS:

Zeros are padded at the beginning of the original time series to make the series length divisible by 2^(n.levels). Thresholds are computed based on Gao (1993).

REFERENCES:

Gao, Hong-Ye (1993). Wavelet Shrinkage Estimates of Spectrum in Time Series.

SEE ALSO:

, , , .

EXAMPLES:

ma.1 <- arima.sim(model=list(ma=1), n=512)  # MA Example 
par(mfrow=c(2,2)) 
plot((1:200)/400, log(4)+2*log(sin(pi*(1:200)/800)), type="l", 
       xlab="frequency", ylab="spectrum", main="True Spectrum") 
ma.raw <- spectrum(ma.1)                    # raw periodogram 
ma.ar <- spectrum(ma.1, "ar")               # AR estimate 
ma.wave <- spec.wave(ma.1, "s10", shrink.level=5) # waveshrink estimate