Learn R Programming

WaveletComp (version 1.0)

wc: Cross-wavelet transformation, wavelet coherence computation, and a simulation algorithm

Description

This function provides Morlet cross-wavelet transformation results of the given two time series, performed within the lower-order functions WaveletCoherency and WaveletTransform subject to criteria concerning the time and frequency resolution, an (optional) lower and/or upper Fourier period, and a variety of filtering methods for the coherence computation. It performs a simulation algorithm to test against a specified alternative hypothesis, which can be chosen from a variety of options, and provides p-values. The selected model will be fitted to the data and simulated according to estimated parameters in order to provide surrogate time series. This function is called by function analyze.coherency.

The name and parts of the layout were inspired by a similar function developed by Huidong Tian and Bernard Cazelles (archived R package WaveletCo). The major part of the code for the computation of the cone of influence, and the code for Fourier-randomized surrogate time series have been adopted from Huidong Tian. The implementation of a choice of filtering windows for the computation of the wavelet coherence was inspired by Luis Aguiar-Conraria and Maria Joana Soares (GWPackage).

Usage

wc(x, y, start = 1, dt = 1, dj = 1/20, 
   lowerPeriod = 2*dt, upperPeriod = floor(length(x)/3)*dt, 
   window.type.t = 1, window.type.s = 1, 
   window.size.t = 5, window.size.s = 1/4,
   make.pval = T, method = "white.noise", params = NULL, 
   n.sim = 100, save.sim = F)

Arguments

x
the time series x to be analyzed
y
the time series y to be analyzed (of the same length as x
start
starting value (in time units) at the time axis (for the computation of the cone of influence)
dt
time resolution, i.e. sampling resolution on time domain, 1/dt = number of intervals per time unit. Default: 1.
dj
frequency resolution, i.e. sampling resolution on frequency domain, 1/dj = number of suboctaves (voices per octave). Default: 1/20.
lowerPeriod
lower Fourier period (in time units) for wavelet decomposition. Default: 2*dt.
upperPeriod
upper Fourier period (in time units) for wavelet decomposition. Default: (floor of one third of time series length)*dt.
window.type.t
type of window for smoothing in time direction, select from: rllll{ 0 ("none") : no smoothing in time direction 1 ("bar") : Bartlett 2 ("tri") : Triangular (Non-Bartlett) 3 ("bo
window.type.s
type of window for smoothing in scale (period) direction, select from: rllll{ 0 ("none") : no smoothing in scale (period) direction 1 ("bar") : Bartlett 2 ("tri") : Triangular (Non-Bar
window.size.t
size of the window used for smoothing in time direction in units of 1/dt. Default: 5, which together with dt=1 defines a window of length 5*(1/dt) = 5. Windows of even-numbered sizes are extended by 1.
window.size.s
size of the window used for smoothing in scale direction in units of 1/dj. Default: 1/4, which together with dj=1/20 defines a window of length (1/4)*(1/dj) = 5. Windows of even-numbered sizes are extended by 1.
make.pval
Compute p-values? Logical. Default: TRUE.
method
the method of generating surrogate time series, select from: rlll{ "white.noise" : white noise "shuffle" : shuffling the given time series "Fourier.rand" : time series with a similar
params
a list of assignments between methods (AR, and ARIMA) and lists of parameter values which apply to surrogates. Default: NULL. Default which includes: AR: AR = list(p=1), where:
n.sim
number of simulations. Default: 100.
save.sim
Shall simulations be saved on the output list? Logical. Default: FALSE.

Value

  • A list with the following elements:
  • Wave.xy(complex-valued) cross-wavelet transform (analogous to Fourier cross-frequency spectrum, and to the covariance in statistics)
  • Anglephase difference, i.e. phase lead of x over y (= phase.x-phase.y)
  • sWave.xysmoothed (complex-valued) cross-wavelet transform
  • sAnglephase difference, i.e. phase lead of x over y, affected by smoothing
  • Power.xycross-wavelet power (analogous to Fourier cross-frequency power spectrum)
  • Power.xy.avgaverage cross-wavelet power in the frequency domain (averages over time)
  • Power.xy.pvalp-values of cross-wavelet power
  • Power.xy.avg.pvalp-values of average cross-wavelet power
  • Coherency(complex-valued) wavelet coherency of series x over series y in the time/frequency domain, affected by smoothing (analogous to Fourier coherency, and to the coefficient of correlation in statistics)
  • Coherencewavelet coherence (analogous to Fourier coherence, and to the coefficient of determination in statistics (affected by smoothing)
  • Coherence.avgaverage wavelet coherence in the frequency domain (averages across time)
  • Coherence.pvalp-values of wavelet coherence
  • Coherence.avg.pvalp-values of average wavelet coherence
  • Wave.x, Wave.y(complex-valued) wavelet transforms of series x and y
  • Phase.x, Phase.yphases of series x and y
  • Ampl.x, Ampl.yamplitudes of series x and y
  • Power.x, Power.ywavelet power of series x and y
  • Power.x.avg, Power.y.avgaverage wavelet power of series x and y, averages across time
  • Power.x.pval, Power.y.pvalp-values of wavelet power of series x and y
  • Power.x.avg.pval, Power.y.avg.pvalp-values of average wavelet power of series x and y
  • sPower.x, sPower.ysmoothed wavelet power of series x and y
  • Periodthe Fourier periods (in time units)
  • Scalethe scales
  • coi.1, coi.2borders of the region where the wavelet transforms are not influenced by edge effects (cone of influence)
  • ncnumber of columns/time steps
  • nrnumber of rows/scales/Fourier periods
  • axis.1tick levels corresponding to time steps
  • axis.2tick levels corresponding to Fourier periods (= log2(Period))
  • series.sima data frame of the series simulated as surrogates for the (detrended) time series (if both make.pval = TRUE and save.sim = TRUE.)

References

Aguiar-Conraria L., and Soares M.J., 2011. Business cycle synchronization and the Euro: A wavelet analysis. Journal of Macroeconomics 33 (3), 477--489.

Aguiar-Conraria L., and Soares M.J., 2011. The Continuous Wavelet Transform: A Primer. NIPE Working Paper Series 16/2011.

Aguiar-Conraria L., and Soares M.J., 2012. GWPackage. Available at http://sites.google.com/site/aguiarconraria/joanasoares-wavelets; accessed September 4, 2013.

Cazelles B., Chavez M., Berteaux, D., Menard F., Vik J.O., Jenouvrier S., and Stenseth N.C., 2008. Wavelet analysis of ecological time series. Oecologia 156, 287--304.

Liu P.C., 1994. Wavelet spectrum analysis and ocean wind waves. In: Foufoula-Georgiou E., and Kumar P., (eds.), Wavelets in Geophysics, Academic Press, San Diego, 151--166.

Tian, H., and Cazelles, B., 2012. WaveletCo. Available at http://cran.r-project.org/src/contrib/Archive/WaveletCo/, archived April 2013; accessed July 26, 2013.

Torrence C., and Compo G.P., 1998. A practical guide to wavelet analysis. Bulletin of the American Meteorological Society 79 (1), 61--78.

Veleda D., Montagne R., and Araujo M., 2012. Cross-Wavelet Bias Corrected by Normalizing Scales. Journal of Atmospheric and Oceanic Technology 29, 1401--1408.